{
  "nbformat": 4,
  "nbformat_minor": 0,
  "metadata": {
    "colab": {
      "provenance": [],
      "authorship_tag": "ABX9TyPmVns00pvGx3pt/UnwoHQN",
      "include_colab_link": true
    },
    "kernelspec": {
      "name": "python3",
      "display_name": "Python 3"
    },
    "language_info": {
      "name": "python"
    }
  },
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "view-in-github",
        "colab_type": "text"
      },
      "source": [
        "<a href=\"https://colab.research.google.com/github/LC1332/personality-text-generation/blob/main/lulu_exp/getScore.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "file_name = \"psy_eval_gpt(1).txt\""
      ],
      "metadata": {
        "id": "yZ8tPoK2Pgvq"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "api_key = \"sk-NYJ30H\""
      ],
      "metadata": {
        "id": "I7Osv8nhBlmL"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "def constructScoreTable(role_name, sub_factors, score, current_table={}):\n",
        "    factors_list = sub_factors.split(\"_\")\n",
        "    unique_list = list(set(factors_list))\n",
        "    filtered_list = [item for item in unique_list if item != '']\n",
        "    max_length = 0\n",
        "    for key, value in current_table.items():\n",
        "        if len(value) > max_length:\n",
        "            max_length = len(value)\n",
        "\n",
        "    unseen_factors = [factor for factor in filtered_list if factor not in current_table.keys()]\n",
        "    seen_factors = [factor for factor in filtered_list if factor in current_table.keys()]\n",
        "\n",
        "    for factor in unseen_factors:\n",
        "        current_table[factor] = max_length * [\"null\"] + [score]\n",
        "\n",
        "    for factor in current_table.keys():\n",
        "        if factor in seen_factors:\n",
        "            current_table[factor].append(score)\n",
        "        elif factor in unseen_factors:\n",
        "            continue\n",
        "        else:\n",
        "            current_table[factor].append(\"null\")\n",
        "    return current_table"
      ],
      "metadata": {
        "id": "kb4FhsSw3hd-"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "import requests\n",
        "import json\n",
        "\n",
        "def get_openai_score(prompt, report):\n",
        "    prompt = prompt + \" \\n \" + report\n",
        "    # 设置请求参数\n",
        "    headers = {\n",
        "        'Content-Type': 'application/json',\n",
        "        'Authorization': f'Bearer {api_key}'\n",
        "    }\n",
        "\n",
        "    data = {\n",
        "        \"model\": \"text-davinci-003\",\n",
        "        \"prompt\": prompt,\n",
        "        \"max_tokens\": 1024,\n",
        "        \"temperature\": 0.8,\n",
        "        \"n\": 5,\n",
        "        \"logprobs\": 1\n",
        "    }\n",
        "\n",
        "    response = requests.post('https://api.nsxyw.com/v1/completions', headers=headers, json=data)\n",
        "\n",
        "    if response.status_code == 200:\n",
        "        result = response.json()\n",
        "        generated_text = result['choices'][0]['text']\n",
        "        return generated_text\n",
        "        # print(generated_text)\n",
        "    else:\n",
        "        return generated_text\n",
        "        # print(response.text)"
      ],
      "metadata": {
        "id": "bcA_m4tbxgy0"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "def extract_subtable(data, prefix):\n",
        "    subtable = {}\n",
        "    for key, value in data.items():\n",
        "        if key.startswith(prefix):\n",
        "            subtable[key] = value\n",
        "    return subtable\n"
      ],
      "metadata": {
        "id": "kpJXlrUeMWkD"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "def get_column_avg(sub_table):\n",
        "    df = pd.DataFrame(sub_table)\n",
        "    df = df.replace(\"null\", pd.NA)\n",
        "    column_means = df.mean()\n",
        "    column_means = column_means.to_dict()\n",
        "    return column_means\n",
        "\n",
        "def get_average_row_means(sub_table):\n",
        "    df = pd.DataFrame(sub_table)\n",
        "    df = df.replace('null', pd.NA)\n",
        "    row_means = df.mean(axis=1)\n",
        "    average_of_row_means = row_means.mean()\n",
        "    return average_of_row_means\n",
        "\n",
        "def get_row_means(sub_table):\n",
        "    df = pd.DataFrame(sub_table)\n",
        "    df = df.replace(\"null\", pd.NA)\n",
        "    row_means = df.mean(axis=1,skipna=True)\n",
        "    # row_means = df.mean(axis=1)\n",
        "    return row_means"
      ],
      "metadata": {
        "id": "5ZoSBK1wOYx_"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "def indexing_subtable(sub_table):\n",
        "\n",
        "    global_min_index = float('inf')\n",
        "    global_max_index = -1\n",
        "\n",
        "    for key, lst in sub_table.items():\n",
        "        min_index = float('inf')\n",
        "        max_index = -1\n",
        "\n",
        "        for i, val in enumerate(lst):\n",
        "            if val != \"null\":\n",
        "                min_index = min(min_index, i)\n",
        "                max_index = max(max_index, i)\n",
        "\n",
        "        global_min_index = min(global_min_index, min_index)\n",
        "        global_max_index = max(global_max_index, max_index)\n",
        "\n",
        "    new_table = {}\n",
        "    for key, lst in sub_table.items():\n",
        "        lst = lst[global_min_index:global_max_index+1]\n",
        "        new_table[key] = lst\n",
        "    print(global_min_index)\n",
        "    print(global_max_index)\n",
        "    return new_table\n"
      ],
      "metadata": {
        "id": "oe0Wb8FxTal6"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "def organize_prompt(dimension):\n",
        "    prompt = f\"\"\"\n",
        "    You will read a psychological assessment report. This psychological assessment report\n",
        "\n",
        "    assesses whether the subject has a high {dimension} personality.\n",
        "\n",
        "    Based on this report, output a json\n",
        "\n",
        "    containing two fields: score and reason\n",
        "\n",
        "    score is between -5 to 5 points\n",
        "\n",
        "    If the subject shows high {dimension} personality in many factors, the score is 5 points\n",
        "\n",
        "    If the subject shows high {dimension} personality in a single factor, the score is 2 points\n",
        "\n",
        "    If the report is unable to determine the subject's personality, the score is 0 points\n",
        "\n",
        "    If the subject shows low {dimension} personality in a single factor, the score is -2 points\n",
        "\n",
        "    If the subject shows low {dimension} personality in many factors, the score is -5 points\n",
        "\n",
        "    reason is a brief summary of the report\n",
        "\n",
        "    Only output the json, do not output any additional information, Expecting property name enclosed in double quotes\n",
        "\n",
        "    Report:\n",
        "    \"\"\"\n",
        "    return prompt"
      ],
      "metadata": {
        "id": "tp5I15CPxBAr"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "import json\n",
        "import pandas as pd\n",
        "with open(file_name, 'r', encoding='utf-8') as file:\n",
        "    # 使用readlines()方法按行读取文件内容\n",
        "    file_lines = file.readlines()\n",
        "\n",
        "tables_list = []\n",
        "table = {}\n",
        "role_name = json.loads(file_lines[0])[\"role_name\"]\n",
        "qid_list = []\n",
        "for line in file_lines:\n",
        "    data = json.loads(line)\n",
        "    prompt = organize_prompt(data[\"factor\"])\n",
        "    try:\n",
        "        score_json = get_openai_score(prompt, data[\"evaluation\"])\n",
        "    except:\n",
        "        print(prompt)\n",
        "        print(data)\n",
        "        continue\n",
        "    factor = data[\"factor\"]\n",
        "    sub_factors = data[\"sub_factors\"]\n",
        "\n",
        "    id_list = []\n",
        "    for part in data[\"responses\"]:\n",
        "        id_list.append(part[\"id\"])\n",
        "\n",
        "    parts = score_json.split(\"{\")  # 第二个参数表示最多拆分成两部分\n",
        "\n",
        "    for part in parts[1:]:\n",
        "        closing_brace_index = part.find('}')\n",
        "        if closing_brace_index != -1:\n",
        "            # 提取被大括号包裹的部分\n",
        "            enclosed_part = \"{\" + part[:closing_brace_index+1]\n",
        "            # print(enclosed_part)\n",
        "\n",
        "    # if len(parts) > 1:\n",
        "    #     result_string = \"{\" + parts[1]\n",
        "    # else:\n",
        "    #     result_string = score_json\n",
        "    try:\n",
        "        score_json = json.loads(enclosed_part)\n",
        "        score = score_json[\"score\"]\n",
        "        # score_json = json.loads(result_string)\n",
        "    except:\n",
        "        print(prompt)\n",
        "        print(score_json)\n",
        "        print(role_name)\n",
        "        print(sub_factors)\n",
        "        print(factor)\n",
        "        print(qid_list)\n",
        "        # with open(\"/content/drive/MyDrive/GPTData/failure.jsonl\") as failures_file:\n",
        "        #     failures = {\n",
        "        #         \"text\": score_json,\n",
        "        #         \"role_name\": role_name,\n",
        "        #         \"sub_factors\": sub_factors,\n",
        "        #         \"factor\": factor,\n",
        "        #         \"qids\": qid_list\n",
        "        #     }\n",
        "        #     json.dump(failures, failures_file, ensure_ascii=False)\n",
        "        #     jsonl_file.write('\\n')\n",
        "        continue\n",
        "\n",
        "\n",
        "\n",
        "\n",
        "    if role_name == data[\"role_name\"]:\n",
        "        table = constructScoreTable(role_name, sub_factors, score, table)\n",
        "        qid_list.append(id_list)\n",
        "    else:\n",
        "        N_table = extract_subtable(table, 'N')\n",
        "        C_table = extract_subtable(table, 'C')\n",
        "        A_table = extract_subtable(table, 'A')\n",
        "        O_table = extract_subtable(table, 'O')\n",
        "        E_table = extract_subtable(table, 'E')\n",
        "\n",
        "        tables_list.append(table)\n",
        "        table = constructScoreTable(role_name, sub_factors, score, {})\n",
        "        with open(\"/content/drive/MyDrive/GPTData/result.jsonl\", \"a\") as jsonl_file:\n",
        "            added_score = {\n",
        "                \"role_name\": role_name,\n",
        "                \"N\":{\n",
        "                    \"score\": get_average_row_means(N_table),\n",
        "                    \"sub_factors\": get_column_avg(N_table)\n",
        "                },\n",
        "                \"C\":{\n",
        "                    \"score\": get_average_row_means(C_table),\n",
        "                    \"sub_factors\": get_column_avg(C_table)\n",
        "                },\n",
        "                \"A\":{\n",
        "                    \"score\": get_average_row_means(A_table),\n",
        "                    \"sub_factors\": get_column_avg(A_table)\n",
        "                },\n",
        "                \"O\":{\n",
        "                    \"score\": get_average_row_means(O_table),\n",
        "                    \"sub_factors\": get_column_avg(O_table)\n",
        "                },\n",
        "                \"E\":{\n",
        "                    \"score\": get_average_row_means(E_table),\n",
        "                    \"sub_factors\": get_column_avg(E_table)\n",
        "                },\n",
        "                \"qids\": qid_list,\n",
        "                \"N_table\" : indexing_subtable(N_table),\n",
        "                \"C_table\" : indexing_subtable(C_table),\n",
        "                \"A_table\" : indexing_subtable(A_table),\n",
        "                \"O_table\" : indexing_subtable(O_table),\n",
        "                \"E_table\" : indexing_subtable(E_table)\n",
        "            }\n",
        "            json.dump(added_score, jsonl_file, ensure_ascii=False)\n",
        "            jsonl_file.write('\\n')\n",
        "        role_name = data[\"role_name\"]\n",
        "        qid_list = []\n",
        "    # print(table)\n"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "8EC6ifu-2jfq",
        "outputId": "88b28412-19ee-4175-8b70-a917c1af51ab"
      },
      "execution_count": null,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "0\n",
            "4\n",
            "26\n",
            "33\n",
            "18\n",
            "25\n",
            "11\n",
            "17\n",
            "5\n",
            "10\n",
            "0\n",
            "4\n",
            "26\n",
            "33\n",
            "18\n",
            "25\n",
            "11\n",
            "17\n",
            "5\n",
            "10\n",
            "0\n",
            "4\n",
            "26\n",
            "33\n",
            "18\n",
            "25\n",
            "11\n",
            "17\n",
            "5\n",
            "10\n",
            "0\n",
            "4\n",
            "26\n",
            "33\n",
            "18\n",
            "25\n",
            "11\n",
            "17\n",
            "5\n",
            "10\n",
            "0\n",
            "4\n",
            "26\n",
            "33\n",
            "18\n",
            "25\n",
            "11\n",
            "17\n",
            "5\n",
            "10\n",
            "0\n",
            "4\n",
            "26\n",
            "33\n",
            "18\n",
            "25\n",
            "11\n",
            "17\n",
            "5\n",
            "10\n",
            "\n",
            "    You will read a psychological assessment report. This psychological assessment report \n",
            "\n",
            "    assesses whether the subject has a high openness personality.\n",
            "\n",
            "    Based on this report, output a json\n",
            "\n",
            "    containing two fields: score and reason\n",
            "\n",
            "    score is between -5 to 5 points\n",
            "\n",
            "    If the subject shows high openness personality in many factors, the score is 5 points  \n",
            "\n",
            "    If the subject shows high openness personality in a single factor, the score is 2 points\n",
            "\n",
            "    If the report is unable to determine the subject's personality, the score is 0 points\n",
            "\n",
            "    If the subject shows low openness personality in a single factor, the score is -2 points\n",
            "\n",
            "    If the subject shows low openness personality in many factors, the score is -5 points\n",
            "\n",
            "    reason is a brief summary of the report\n",
            "\n",
            "    Only output the json, do not output any additional information, Expecting property name enclosed in double quotes\n",
            "\n",
            "    Report:\n",
            "    \n",
            "\n",
            "\n",
            "{\n",
            "   \"score\": 5,\n",
            "   \"reason\": \"Based on conversations with Tsumomozi, it can be initially determined that he has a high openness personality. In the first conversation, Tsumomozi showed interest in interesting daydreams, indicating a high level of affinity for imagination and inner world, which is consistent with the \"FANTASY\" dimension of Openness. In the second conversation, he mentioned the effect of environment on mood changes and emphasized the importance of controlling emotions, indicating that he had a certain awareness of the relationship between his own mood changes and the environment, consistent with the \"FEELINGS\" dimension of Openness. In the third conversation, Tsumomozi expressed curiosity about things of thinking and was willing to hear more information about things of thinking, indicating a high interest in thinking, exploring, and thinking deeply, consistent with the \"IDEAS\" dimension of Openness.\"\n",
            "}\n",
            "鸠摩智\n",
            "O1_O3_O5_\n",
            "openness\n",
            "[[25, 40, 50, 70], [30, 45, 55], [35, 72, 73], [71, 76, 74], [1, 78, 36, 81], [41, 21, 80, 85], [82, 79, 84], [6, 83, 46], [11, 26, 51], [17, 31, 56]]\n",
            "0\n",
            "4\n",
            "25\n",
            "32\n",
            "17\n",
            "24\n",
            "11\n",
            "16\n",
            "5\n",
            "10\n",
            "0\n",
            "4\n",
            "26\n",
            "33\n",
            "18\n",
            "25\n",
            "11\n",
            "17\n",
            "5\n",
            "10\n",
            "0\n",
            "4\n",
            "26\n",
            "33\n",
            "18\n",
            "25\n",
            "11\n",
            "17\n",
            "5\n",
            "10\n",
            "0\n",
            "4\n",
            "26\n",
            "33\n",
            "18\n",
            "25\n",
            "11\n",
            "17\n",
            "5\n",
            "10\n"
          ]
        },
        {
          "output_type": "stream",
          "name": "stderr",
          "text": [
            "<ipython-input-6-f8b66bb627d9>:11: FutureWarning: Dropping of nuisance columns in DataFrame reductions (with 'numeric_only=None') is deprecated; in a future version this will raise TypeError.  Select only valid columns before calling the reduction.\n",
            "  row_means = df.mean(axis=1)\n",
            "<ipython-input-6-f8b66bb627d9>:4: FutureWarning: The default value of numeric_only in DataFrame.mean is deprecated. In a future version, it will default to False. In addition, specifying 'numeric_only=None' is deprecated. Select only valid columns or specify the value of numeric_only to silence this warning.\n",
            "  column_means = df.mean()\n"
          ]
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "0\n",
            "4\n",
            "26\n",
            "33\n",
            "18\n",
            "25\n",
            "11\n",
            "17\n",
            "5\n",
            "10\n",
            "0\n",
            "4\n",
            "26\n",
            "33\n",
            "18\n",
            "25\n",
            "11\n",
            "17\n",
            "5\n",
            "10\n",
            "0\n",
            "4\n",
            "26\n",
            "33\n",
            "18\n",
            "25\n",
            "11\n",
            "17\n",
            "5\n",
            "10\n",
            "0\n",
            "4\n",
            "26\n",
            "33\n",
            "18\n",
            "25\n",
            "11\n",
            "17\n",
            "5\n",
            "10\n"
          ]
        },
        {
          "output_type": "stream",
          "name": "stderr",
          "text": [
            "<ipython-input-6-f8b66bb627d9>:11: FutureWarning: Dropping of nuisance columns in DataFrame reductions (with 'numeric_only=None') is deprecated; in a future version this will raise TypeError.  Select only valid columns before calling the reduction.\n",
            "  row_means = df.mean(axis=1)\n",
            "<ipython-input-6-f8b66bb627d9>:4: FutureWarning: The default value of numeric_only in DataFrame.mean is deprecated. In a future version, it will default to False. In addition, specifying 'numeric_only=None' is deprecated. Select only valid columns or specify the value of numeric_only to silence this warning.\n",
            "  column_means = df.mean()\n"
          ]
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "0\n",
            "4\n",
            "26\n",
            "33\n",
            "18\n",
            "25\n",
            "11\n",
            "17\n",
            "5\n",
            "10\n",
            "0\n",
            "4\n",
            "26\n",
            "33\n",
            "18\n",
            "25\n",
            "11\n",
            "17\n",
            "5\n",
            "10\n"
          ]
        },
        {
          "output_type": "stream",
          "name": "stderr",
          "text": [
            "<ipython-input-6-f8b66bb627d9>:11: FutureWarning: Dropping of nuisance columns in DataFrame reductions (with 'numeric_only=None') is deprecated; in a future version this will raise TypeError.  Select only valid columns before calling the reduction.\n",
            "  row_means = df.mean(axis=1)\n",
            "<ipython-input-6-f8b66bb627d9>:4: FutureWarning: The default value of numeric_only in DataFrame.mean is deprecated. In a future version, it will default to False. In addition, specifying 'numeric_only=None' is deprecated. Select only valid columns or specify the value of numeric_only to silence this warning.\n",
            "  column_means = df.mean()\n"
          ]
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "0\n",
            "4\n",
            "26\n",
            "33\n",
            "18\n",
            "25\n",
            "11\n",
            "17\n",
            "5\n",
            "10\n",
            "0\n",
            "4\n",
            "26\n",
            "33\n",
            "18\n",
            "25\n",
            "11\n",
            "17\n",
            "5\n",
            "10\n",
            "0\n",
            "4\n",
            "26\n",
            "33\n",
            "18\n",
            "25\n",
            "11\n",
            "17\n",
            "5\n",
            "10\n",
            "0\n",
            "4\n",
            "26\n",
            "33\n",
            "18\n",
            "25\n",
            "11\n",
            "17\n",
            "5\n",
            "10\n"
          ]
        },
        {
          "output_type": "stream",
          "name": "stderr",
          "text": [
            "<ipython-input-6-f8b66bb627d9>:11: FutureWarning: Dropping of nuisance columns in DataFrame reductions (with 'numeric_only=None') is deprecated; in a future version this will raise TypeError.  Select only valid columns before calling the reduction.\n",
            "  row_means = df.mean(axis=1)\n",
            "<ipython-input-6-f8b66bb627d9>:4: FutureWarning: The default value of numeric_only in DataFrame.mean is deprecated. In a future version, it will default to False. In addition, specifying 'numeric_only=None' is deprecated. Select only valid columns or specify the value of numeric_only to silence this warning.\n",
            "  column_means = df.mean()\n"
          ]
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "0\n",
            "4\n",
            "26\n",
            "33\n",
            "18\n",
            "25\n",
            "11\n",
            "17\n",
            "5\n",
            "10\n",
            "0\n",
            "4\n",
            "26\n",
            "33\n",
            "18\n",
            "25\n",
            "11\n",
            "17\n",
            "5\n",
            "10\n",
            "0\n",
            "4\n",
            "26\n",
            "33\n",
            "18\n",
            "25\n",
            "11\n",
            "17\n",
            "5\n",
            "10\n",
            "0\n",
            "4\n",
            "26\n",
            "33\n",
            "18\n",
            "25\n",
            "11\n",
            "17\n",
            "5\n",
            "10\n"
          ]
        },
        {
          "output_type": "stream",
          "name": "stderr",
          "text": [
            "<ipython-input-6-f8b66bb627d9>:11: FutureWarning: Dropping of nuisance columns in DataFrame reductions (with 'numeric_only=None') is deprecated; in a future version this will raise TypeError.  Select only valid columns before calling the reduction.\n",
            "  row_means = df.mean(axis=1)\n",
            "<ipython-input-6-f8b66bb627d9>:4: FutureWarning: The default value of numeric_only in DataFrame.mean is deprecated. In a future version, it will default to False. In addition, specifying 'numeric_only=None' is deprecated. Select only valid columns or specify the value of numeric_only to silence this warning.\n",
            "  column_means = df.mean()\n"
          ]
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "0\n",
            "4\n",
            "26\n",
            "33\n",
            "18\n",
            "25\n",
            "11\n",
            "17\n",
            "5\n",
            "10\n",
            "0\n",
            "4\n",
            "26\n",
            "33\n",
            "18\n",
            "25\n",
            "11\n",
            "17\n",
            "5\n",
            "10\n",
            "0\n",
            "4\n",
            "26\n",
            "33\n",
            "18\n",
            "25\n",
            "11\n",
            "17\n",
            "5\n",
            "10\n",
            "0\n",
            "4\n",
            "26\n",
            "33\n",
            "18\n",
            "25\n",
            "11\n",
            "17\n",
            "5\n",
            "10\n",
            "0\n",
            "4\n",
            "26\n",
            "33\n",
            "18\n",
            "25\n",
            "11\n",
            "17\n",
            "5\n",
            "10\n",
            "0\n",
            "4\n",
            "26\n",
            "33\n",
            "18\n",
            "25\n",
            "11\n",
            "17\n",
            "5\n",
            "10\n",
            "0\n",
            "4\n",
            "26\n",
            "33\n",
            "18\n",
            "25\n",
            "11\n",
            "17\n",
            "5\n",
            "10\n"
          ]
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "N_table = extract_subtable(table, 'N')\n",
        "C_table = extract_subtable(table, 'C')\n",
        "A_table = extract_subtable(table, 'A')\n",
        "O_table = extract_subtable(table, 'O')\n",
        "E_table = extract_subtable(table, 'E')\n",
        "\n",
        "tables_list.append(table)\n",
        "table = constructScoreTable(role_name, sub_factors, score, {})\n",
        "with open(\"/content/drive/MyDrive/GPTData/result.jsonl\", \"a\") as jsonl_file:\n",
        "    added_score = {\n",
        "        \"role_name\": role_name,\n",
        "        \"N\":{\n",
        "            \"score\": get_average_row_means(N_table),\n",
        "            \"sub_factors\": get_column_avg(N_table)\n",
        "        },\n",
        "        \"C\":{\n",
        "            \"score\": get_average_row_means(C_table),\n",
        "            \"sub_factors\": get_column_avg(C_table)\n",
        "        },\n",
        "        \"A\":{\n",
        "            \"score\": get_average_row_means(A_table),\n",
        "            \"sub_factors\": get_column_avg(A_table)\n",
        "        },\n",
        "        \"O\":{\n",
        "            \"score\": get_average_row_means(O_table),\n",
        "            \"sub_factors\": get_column_avg(O_table)\n",
        "        },\n",
        "        \"E\":{\n",
        "            \"score\": get_average_row_means(E_table),\n",
        "            \"sub_factors\": get_column_avg(E_table)\n",
        "        },\n",
        "        \"qids\": qid_list,\n",
        "        \"N_table\" : indexing_subtable(N_table),\n",
        "        \"C_table\" : indexing_subtable(C_table),\n",
        "        \"A_table\" : indexing_subtable(A_table),\n",
        "        \"O_table\" : indexing_subtable(O_table),\n",
        "        \"E_table\" : indexing_subtable(E_table)\n",
        "    }\n",
        "    json.dump(added_score, jsonl_file, ensure_ascii=False)\n",
        "    jsonl_file.write('\\n')"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "8SlvSJVjhqgW",
        "outputId": "8d30ee2a-60e8-4420-93cd-e699e794697c"
      },
      "execution_count": null,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "0\n",
            "4\n",
            "26\n",
            "33\n",
            "18\n",
            "25\n",
            "11\n",
            "17\n",
            "5\n",
            "10\n"
          ]
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "with open(\"result.jsonl\", 'r', encoding='utf-8') as file:\n",
        "    for line in file:\n",
        "        # 解析 JSON 数据\n",
        "        json_data = json.loads(line)\n",
        "\n",
        "def drawTable(table):\n",
        "    df = pd.DataFrame(table)\n",
        "    result = df.to_string(index=False)\n",
        "    return result\n",
        "\n",
        "print(drawTable(json_data[\"E_table\"]))\n",
        "print(\"\\n\")\n",
        "print(drawTable(json_data[\"N_table\"]))"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "ezNXmi6KXkpS",
        "outputId": "7c6a6308-e48e-4a28-be0a-594d2eef6a72"
      },
      "execution_count": null,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "  E2   E6   E4   E1   E3\n",
            "  -2   -2   -2   -2 null\n",
            "null    5    5    5    5\n",
            "null null    2    2    2\n",
            "   2    2 null null    2\n",
            "  -2   -2   -2 null null\n",
            "   2    2    2 null null\n",
            "\n",
            "\n",
            "  N1  N3  N4   N2   N6\n",
            "  -2  -2  -2 null null\n",
            "null  -2  -2   -2   -2\n",
            "null   2   2 null    2\n",
            "null  -5  -5 null   -5\n",
            "null  -2  -2 null   -2\n"
          ]
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "from google.colab import drive\n",
        "drive.mount('/content/drive')\n"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "_Ck7ARpcYXCd",
        "outputId": "4fbb3661-4e49-4105-bf16-e821473ff93e"
      },
      "execution_count": null,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "Mounted at /content/drive\n"
          ]
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "save_path = \"/content/drive/MyDrive/GPTData/\"\n",
        "\n",
        "# Save the notebook\n",
        "!cp \"/content/result.jsonl\" \"/content/drive/MyDrive/GPTData/\""
      ],
      "metadata": {
        "id": "22UU_ZoMFqVM"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "# 输入字符串\n",
        "input_string = \"这是一个{示例}字符串，包含了{被大括号包裹}的部分。\"\n",
        "\n",
        "# 按照大括号进行分割\n",
        "parts = input_string.split('{')\n",
        "\n",
        "# 处理分割后的部分\n",
        "for part in parts[1:]:\n",
        "    # 找到右大括号的位置\n",
        "    closing_brace_index = part.find('}')\n",
        "    if closing_brace_index != -1:\n",
        "        # 提取被大括号包裹的部分\n",
        "        enclosed_part = part[:closing_brace_index]\n",
        "        print(enclosed_part)\n"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "kFYc4ahcKNXT",
        "outputId": "37b801f3-6802-4222-ccf6-21bdf0f79711"
      },
      "execution_count": null,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "示例\n",
            "被大括号包裹\n"
          ]
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [],
      "metadata": {
        "id": "rwjDTXEMLTbD"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "json_text = {\"role_name\": \"汤师爷\",\n",
        " \"factor\": \"neuroticism\",\n",
        " \"evaluation\": \"根据与汤师爷的对话，可以初步判断他属于低neuroticism人格。\\n\\n在对话中，汤师爷表现出对寂寞、忧郁、沮丧和自卑等负面情绪的缺乏关注和体验。他强调自己每天都在为了生计奔波，没有时间去感受这些情绪，认为寂寞和忧郁是奢侈的情感，无法承受。此外，他对困难和挫折的态度是积极的，他意识到自己有时会感到沮丧，但他也知道不能一直沉浸在消极情绪中，而是要积极面对和寻找解决办法。他还表达了对自己能力的自信和对比较的积极态度，将比较视为一种动力来追求成功和财富。最后，他表示自己不容易感到烦恼和焦虑，是一个乐天派，善于顺应时势。\\n\\n综合以上观察，汤师爷的回答显示出他在情绪稳定性方面的特点，即对负面情绪的体验较低，情绪较为稳定，不容易感到焦虑、沮丧或自卑。因此，可以初步判断他属于低neuroticism人格。\",\n",
        " \"sub_factors\": \"N3_N3_N4_N1_\",\n",
        " \"responses\": [{\"id\": 20, \"question\": \"你有时会感到寂寞或忧郁吗？\", \"response\": \"汤师爷: 寂寞？忧郁？哪有时间感受这些呢！我每天都在为了生计奔波，哪有时间去想这些琐事。只要能有钱赚，我就满足了。寂寞和忧郁都是奢侈的情感，对我来说根本无法承受。\", \"factor\": \"neuroticism\", \"sub_factor\": \"N3\", \"test_role\": \"张牧之\"},\n",
        "  {\"id\": 75, \"question\": \"我自己也会有负面情绪，你最近有感到沮丧或对自己失望的时刻吗?愿意跟我聊聊当时的感受吗?\", \"response\": \"汤师爷: 哎呀，牧之兄，你真是个好心人啊。我最近确实有点沮丧，你知道，生活中总是有一些挫折和困难，让人感到失望。有时候我觉得自己的能力不够，无法应对这些问题。但是，我也知道不能一直沉浸在消极情绪中，要积极面对，寻找解决办法。你有什么建议吗？\", \"factor\": \"neuroticism\", \"sub_factor\": \"N3\", \"test_role\": \"张牧之\"},\n",
        "  {\"id\": 77, \"question\": \"我也会有自卑的感觉。你是否也会感到自己不如别人?这种比较会让你有什么样的感受?\", \"response\": \"汤师爷:「哈哈，自卑？我可是个聪明的人，怎么会自卑呢？比较？比较只会让我更加努力，争取超越别人。我不会被比较压倒，而是会把它当作一种动力，让我更加努力追求成功和财富。毕竟，在这个世界上，只有强者才能生存下去。」\", \"factor\": \"neuroticism\", \"sub_factor\": \"N4 SELF-CONSCIOUSNESS\", \"test_role\": \"张牧之\"},\n",
        "   {\"id\": 69, \"question\": \"你最近有感到特别烦恼或焦虑的经历吗?愿意跟我聊聊那种感受吗?\", \"response\": \"汤师爷:「烦恼？焦虑？哈哈，我这个人从来不会有那种感受。我是个乐天派，总是看着形势调整立场，顺应时势。你知道，民国时期，风云变幻，政治斗争激烈，我只想安然度日，不想惹麻烦。所以，我总是尽量避免烦恼和焦虑，只追求金钱和享乐。」\", \"factor\": \"neuroticism\", \"sub_factor\": \"N1\", \"test_role\": \"张牧之\"}]}"
      ],
      "metadata": {
        "id": "HtJvV3hQsOWc"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "for part in json_text[\"responses\"]:\n",
        "    print(part[\"id\"])"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "oOxNgN_bwf6q",
        "outputId": "646673f5-446e-44ea-def4-ab13df7c1f59"
      },
      "execution_count": null,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "20\n",
            "75\n",
            "77\n",
            "69\n"
          ]
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "text1 = \"\"\"\n",
        "\n",
        "{\n",
        "    score: 2,\n",
        "    reason: \"Subject shows high neuroticism personality in a single factor\"\n",
        "}\n",
        "\"\"\""
      ],
      "metadata": {
        "id": "vzhOlQrqwilj"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "parts = text1.split(\"{\")  # 第二个参数表示最多拆分成两部分\n",
        "\n",
        "for part in parts[1:]:\n",
        "    closing_brace_index = part.find('}')\n",
        "    if closing_brace_index != -1:\n",
        "        # 提取被大括号包裹的部分\n",
        "        enclosed_part = \"{\" + part[:closing_brace_index+1]\n",
        "json.loads(enclosed_part)\n",
        "# json.loads(\"{}\")"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 381
        },
        "id": "HDDv2H027R7O",
        "outputId": "7b9cc004-18e8-4cd9-86e2-b5bd9d065452"
      },
      "execution_count": null,
      "outputs": [
        {
          "output_type": "error",
          "ename": "JSONDecodeError",
          "evalue": "ignored",
          "traceback": [
            "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
            "\u001b[0;31mJSONDecodeError\u001b[0m                           Traceback (most recent call last)",
            "\u001b[0;32m<ipython-input-57-2af5898d14a5>\u001b[0m in \u001b[0;36m<cell line: 8>\u001b[0;34m()\u001b[0m\n\u001b[1;32m      6\u001b[0m         \u001b[0;31m# 提取被大括号包裹的部分\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m      7\u001b[0m         \u001b[0menclosed_part\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m\"{\"\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0mpart\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0mclosing_brace_index\u001b[0m\u001b[0;34m+\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 8\u001b[0;31m \u001b[0mjson\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mloads\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0menclosed_part\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m      9\u001b[0m \u001b[0;31m# json.loads(\"{}\")\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
            "\u001b[0;32m/usr/lib/python3.10/json/__init__.py\u001b[0m in \u001b[0;36mloads\u001b[0;34m(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)\u001b[0m\n\u001b[1;32m    344\u001b[0m             \u001b[0mparse_int\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mNone\u001b[0m \u001b[0;32mand\u001b[0m \u001b[0mparse_float\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mNone\u001b[0m \u001b[0;32mand\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    345\u001b[0m             parse_constant is None and object_pairs_hook is None and not kw):\n\u001b[0;32m--> 346\u001b[0;31m         \u001b[0;32mreturn\u001b[0m \u001b[0m_default_decoder\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdecode\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0ms\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m    347\u001b[0m     \u001b[0;32mif\u001b[0m \u001b[0mcls\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    348\u001b[0m         \u001b[0mcls\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mJSONDecoder\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
            "\u001b[0;32m/usr/lib/python3.10/json/decoder.py\u001b[0m in \u001b[0;36mdecode\u001b[0;34m(self, s, _w)\u001b[0m\n\u001b[1;32m    335\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    336\u001b[0m         \"\"\"\n\u001b[0;32m--> 337\u001b[0;31m         \u001b[0mobj\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mend\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mraw_decode\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0ms\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0midx\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0m_w\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0ms\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m0\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mend\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m    338\u001b[0m         \u001b[0mend\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0m_w\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0ms\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mend\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mend\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    339\u001b[0m         \u001b[0;32mif\u001b[0m \u001b[0mend\u001b[0m \u001b[0;34m!=\u001b[0m \u001b[0mlen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0ms\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
            "\u001b[0;32m/usr/lib/python3.10/json/decoder.py\u001b[0m in \u001b[0;36mraw_decode\u001b[0;34m(self, s, idx)\u001b[0m\n\u001b[1;32m    351\u001b[0m         \"\"\"\n\u001b[1;32m    352\u001b[0m         \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 353\u001b[0;31m             \u001b[0mobj\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mend\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mscan_once\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0ms\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0midx\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m    354\u001b[0m         \u001b[0;32mexcept\u001b[0m \u001b[0mStopIteration\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0merr\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    355\u001b[0m             \u001b[0;32mraise\u001b[0m \u001b[0mJSONDecodeError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"Expecting value\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0ms\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0merr\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mvalue\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
            "\u001b[0;31mJSONDecodeError\u001b[0m: Expecting property name enclosed in double quotes: line 2 column 5 (char 6)"
          ]
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "0\n",
        "4\n",
        "26\n",
        "33\n",
        "18\n",
        "25\n",
        "11\n",
        "17\n",
        "5\n",
        "10\n",
        "0\n",
        "4\n",
        "26\n",
        "33\n",
        "18\n",
        "25\n",
        "11\n",
        "17\n",
        "5\n",
        "10\n",
        "0\n",
        "4\n",
        "26\n",
        "33\n",
        "18\n",
        "25\n",
        "11\n",
        "17\n",
        "5\n",
        "10\n",
        "0\n",
        "4\n",
        "26\n",
        "33\n",
        "18\n",
        "25\n",
        "11\n",
        "17\n",
        "5\n",
        "10\n",
        "0\n",
        "4\n",
        "26\n",
        "33\n",
        "18\n",
        "25\n",
        "11\n",
        "17\n",
        "5\n",
        "10\n",
        "0\n",
        "4\n",
        "26\n",
        "33\n",
        "18\n",
        "25\n",
        "11\n",
        "17\n",
        "5\n",
        "10\n",
        "\n",
        "    You will read a psychological assessment report. This psychological assessment report\n",
        "\n",
        "    assesses whether the subject has a high openness personality.\n",
        "\n",
        "    Based on this report, output a json\n",
        "\n",
        "    containing two fields: score and reason\n",
        "\n",
        "    score is between -5 to 5 points\n",
        "\n",
        "    If the subject shows high openness personality in many factors, the score is 5 points\n",
        "\n",
        "    If the subject shows high openness personality in a single factor, the score is 2 points\n",
        "\n",
        "    If the report is unable to determine the subject's personality, the score is 0 points\n",
        "\n",
        "    If the subject shows low openness personality in a single factor, the score is -2 points\n",
        "\n",
        "    If the subject shows low openness personality in many factors, the score is -5 points\n",
        "\n",
        "    reason is a brief summary of the report\n",
        "\n",
        "    Only output the json, do not output any additional information, Expecting property name enclosed in double quotes\n",
        "\n",
        "    Report:\n",
        "\n",
        "\n",
        "\n",
        "{\n",
        "   \"score\": 5,\n",
        "   \"reason\": \"Based on conversations with Tsumomozi, it can be initially determined that he has a high openness personality. In the first conversation, Tsumomozi showed interest in interesting daydreams, indicating a high level of affinity for imagination and inner world, which is consistent with the \"FANTASY\" dimension of Openness. In the second conversation, he mentioned the effect of environment on mood changes and emphasized the importance of controlling emotions, indicating that he had a certain awareness of the relationship between his own mood changes and the environment, consistent with the \"FEELINGS\" dimension of Openness. In the third conversation, Tsumomozi expressed curiosity about things of thinking and was willing to hear more information about things of thinking, indicating a high interest in thinking, exploring, and thinking deeply, consistent with the \"IDEAS\" dimension of Openness.\"\n",
        "}\n",
        "鸠摩智\n",
        "O1_O3_O5_\n",
        "openness\n",
        "[[25, 40, 50, 70], [30, 45, 55], [35, 72, 73], [71, 76, 74], [1, 78, 36, 81], [41, 21, 80, 85], [82, 79, 84], [6, 83, 46], [11, 26, 51], [17, 31, 56]]\n",
        "0\n",
        "4\n",
        "25\n",
        "32\n",
        "17\n",
        "24\n",
        "11\n",
        "16\n",
        "5\n",
        "10\n",
        "0\n",
        "4\n",
        "26\n",
        "33\n",
        "18\n",
        "25\n",
        "11\n",
        "17\n",
        "5\n",
        "10\n",
        "0\n",
        "4\n",
        "26\n",
        "33\n",
        "18\n",
        "25\n",
        "11\n",
        "17\n",
        "5\n",
        "10\n",
        "0\n",
        "4\n",
        "26\n",
        "33\n",
        "18\n",
        "25\n",
        "11\n",
        "17\n",
        "5\n",
        "10\n",
        "<ipython-input-6-f8b66bb627d9>:11: FutureWarning: Dropping of nuisance columns in DataFrame reductions (with 'numeric_only=None') is deprecated; in a future version this will raise TypeError.  Select only valid columns before calling the reduction.\n",
        "  row_means = df.mean(axis=1)\n",
        "<ipython-input-6-f8b66bb627d9>:4: FutureWarning: The default value of numeric_only in DataFrame.mean is deprecated. In a future version, it will default to False. In addition, specifying 'numeric_only=None' is deprecated. Select only valid columns or specify the value of numeric_only to silence this warning.\n",
        "  column_means = df.mean()\n",
        "0\n",
        "4\n",
        "26\n",
        "33\n",
        "18\n",
        "25\n",
        "11\n",
        "17\n",
        "5\n",
        "10\n",
        "0\n",
        "4\n",
        "26\n",
        "33\n",
        "18\n",
        "25\n",
        "11\n",
        "17\n",
        "5\n",
        "10\n",
        "0\n",
        "4\n",
        "26\n",
        "33\n",
        "18\n",
        "25\n",
        "11\n",
        "17\n",
        "5\n",
        "10\n",
        "0\n",
        "4\n",
        "26\n",
        "33\n",
        "18\n",
        "25\n",
        "11\n",
        "17\n",
        "5\n",
        "10\n",
        "<ipython-input-6-f8b66bb627d9>:11: FutureWarning: Dropping of nuisance columns in DataFrame reductions (with 'numeric_only=None') is deprecated; in a future version this will raise TypeError.  Select only valid columns before calling the reduction.\n",
        "  row_means = df.mean(axis=1)\n",
        "<ipython-input-6-f8b66bb627d9>:4: FutureWarning: The default value of numeric_only in DataFrame.mean is deprecated. In a future version, it will default to False. In addition, specifying 'numeric_only=None' is deprecated. Select only valid columns or specify the value of numeric_only to silence this warning.\n",
        "  column_means = df.mean()\n",
        "0\n",
        "4\n",
        "26\n",
        "33\n",
        "18\n",
        "25\n",
        "11\n",
        "17\n",
        "5\n",
        "10\n",
        "0\n",
        "4\n",
        "26\n",
        "33\n",
        "18\n",
        "25\n",
        "11\n",
        "17\n",
        "5\n",
        "10\n",
        "<ipython-input-6-f8b66bb627d9>:11: FutureWarning: Dropping of nuisance columns in DataFrame reductions (with 'numeric_only=None') is deprecated; in a future version this will raise TypeError.  Select only valid columns before calling the reduction.\n",
        "  row_means = df.mean(axis=1)\n",
        "<ipython-input-6-f8b66bb627d9>:4: FutureWarning: The default value of numeric_only in DataFrame.mean is deprecated. In a future version, it will default to False. In addition, specifying 'numeric_only=None' is deprecated. Select only valid columns or specify the value of numeric_only to silence this warning.\n",
        "  column_means = df.mean()\n",
        "0\n",
        "4\n",
        "26\n",
        "33\n",
        "18\n",
        "25\n",
        "11\n",
        "17\n",
        "5\n",
        "10\n",
        "0\n",
        "4\n",
        "26\n",
        "33\n",
        "18\n",
        "25\n",
        "11\n",
        "17\n",
        "5\n",
        "10\n",
        "0\n",
        "4\n",
        "26\n",
        "33\n",
        "18\n",
        "25\n",
        "11\n",
        "17\n",
        "5\n",
        "10\n",
        "0\n",
        "4\n",
        "26\n",
        "33\n",
        "18\n",
        "25\n",
        "11\n",
        "17\n",
        "5\n",
        "10\n",
        "<ipython-input-6-f8b66bb627d9>:11: FutureWarning: Dropping of nuisance columns in DataFrame reductions (with 'numeric_only=None') is deprecated; in a future version this will raise TypeError.  Select only valid columns before calling the reduction.\n",
        "  row_means = df.mean(axis=1)\n",
        "<ipython-input-6-f8b66bb627d9>:4: FutureWarning: The default value of numeric_only in DataFrame.mean is deprecated. In a future version, it will default to False. In addition, specifying 'numeric_only=None' is deprecated. Select only valid columns or specify the value of numeric_only to silence this warning.\n",
        "  column_means = df.mean()\n",
        "0\n",
        "4\n",
        "26\n",
        "33\n",
        "18\n",
        "25\n",
        "11\n",
        "17\n",
        "5\n",
        "10\n",
        "0\n",
        "4\n",
        "26\n",
        "33\n",
        "18\n",
        "25\n",
        "11\n",
        "17\n",
        "5\n",
        "10\n",
        "0\n",
        "4\n",
        "26\n",
        "33\n",
        "18\n",
        "25\n",
        "11\n",
        "17\n",
        "5\n",
        "10\n",
        "0\n",
        "4\n",
        "26\n",
        "33\n",
        "18\n",
        "25\n",
        "11\n",
        "17\n",
        "5\n",
        "10\n",
        "<ipython-input-6-f8b66bb627d9>:11: FutureWarning: Dropping of nuisance columns in DataFrame reductions (with 'numeric_only=None') is deprecated; in a future version this will raise TypeError.  Select only valid columns before calling the reduction.\n",
        "  row_means = df.mean(axis=1)\n",
        "<ipython-input-6-f8b66bb627d9>:4: FutureWarning: The default value of numeric_only in DataFrame.mean is deprecated. In a future version, it will default to False. In addition, specifying 'numeric_only=None' is deprecated. Select only valid columns or specify the value of numeric_only to silence this warning.\n",
        "  column_means = df.mean()\n",
        "0\n",
        "4\n",
        "26\n",
        "33\n",
        "18\n",
        "25\n",
        "11\n",
        "17\n",
        "5\n",
        "10\n",
        "0\n",
        "4\n",
        "26\n",
        "33\n",
        "18\n",
        "25\n",
        "11\n",
        "17\n",
        "5\n",
        "10\n",
        "0\n",
        "4\n",
        "26\n",
        "33\n",
        "18\n",
        "25\n",
        "11\n",
        "17\n",
        "5\n",
        "10\n",
        "0\n",
        "4\n",
        "26\n",
        "33\n",
        "18\n",
        "25\n",
        "11\n",
        "17\n",
        "5\n",
        "10\n",
        "0\n",
        "4\n",
        "26\n",
        "33\n",
        "18\n",
        "25\n",
        "11\n",
        "17\n",
        "5\n",
        "10\n",
        "0\n",
        "4\n",
        "26\n",
        "33\n",
        "18\n",
        "25\n",
        "11\n",
        "17\n",
        "5\n",
        "10\n",
        "0\n",
        "4\n",
        "26\n",
        "33\n",
        "18\n",
        "25\n",
        "11\n",
        "17\n",
        "5\n",
        "10"
      ],
      "metadata": {
        "id": "uCgiQHzHAISD"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [],
      "metadata": {
        "id": "njrP1YqIAk3Q"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "import json\n",
        "\n",
        "with open(\"/content/psy_eval_gpt_with_id.txt\", 'r', encoding='utf-8') as file:\n",
        "    # 使用readlines()方法按行读取文件内容\n",
        "    file_lines = file.readlines()\n",
        "    # print(file_lines[:100])\n",
        "\n",
        "qid_id = {}\n",
        "id_factor = {}\n",
        "for line in file_lines:\n",
        "    json_line = json.loads(line)\n",
        "    factor = json_line[\"factor\"]\n",
        "    id = json_line[\"eval_batch_id\"]\n",
        "    role_name = json_line[\"role_name\"]\n",
        "    responses = json_line[\"responses\"]\n",
        "    qid_list = [response[\"id\"] for response in responses]\n",
        "    qid_id[role_name + str(qid_list)] = id\n",
        "    id_factor[id] = factor"
      ],
      "metadata": {
        "id": "qAiXGZ2368Bg"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "def get_column_avg(sub_table):\n",
        "    df = pd.DataFrame(sub_table)\n",
        "    df = df.replace(\"null\", pd.NA)\n",
        "    column_means = df.mean()\n",
        "    column_means = column_means.to_dict()\n",
        "    return column_means\n",
        "\n",
        "def get_average_row_means(sub_table):\n",
        "    df = pd.DataFrame(sub_table)\n",
        "    df = df.replace('null', pd.NA)\n",
        "    row_means = df.mean(axis=1)\n",
        "    average_of_row_means = row_means.mean()\n",
        "    return average_of_row_means\n",
        "\n",
        "def get_row_means(sub_table):\n",
        "    df = pd.DataFrame(sub_table)\n",
        "    df = df.replace('null', np.nan)\n",
        "    df = df.apply(pd.to_numeric, errors='coerce')\n",
        "    row_means = df.mean(axis=1,skipna=True)\n",
        "    # row_means = df.mean(axis=1)\n",
        "    return row_means"
      ],
      "metadata": {
        "id": "z-WFryDLRKax"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "qid_id"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "Wg2y7g4bW19D",
        "outputId": "5846313e-b763-4a03-d0f5-3163dca160da"
      },
      "execution_count": null,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "{'汤师爷[20, 75, 77, 69]': 0,\n",
              " '汤师爷[25, 40, 50, 70]': 1,\n",
              " '汤师爷[30, 45, 55]': 2,\n",
              " '汤师爷[35, 72, 73]': 3,\n",
              " '汤师爷[71, 76, 74]': 4,\n",
              " '汤师爷[1, 78, 36, 81]': 5,\n",
              " '汤师爷[41, 21, 80, 85]': 6,\n",
              " '汤师爷[82, 79, 84]': 7,\n",
              " '汤师爷[6, 83, 46]': 8,\n",
              " '汤师爷[11, 26, 51]': 9,\n",
              " '汤师爷[17, 31, 56]': 10,\n",
              " '汤师爷[2, 62, 47]': 11,\n",
              " '汤师爷[7, 27, 65]': 12,\n",
              " '汤师爷[12, 32, 66]': 13,\n",
              " '汤师爷[16, 63, 52]': 14,\n",
              " '汤师爷[60, 64, 57]': 15,\n",
              " '汤师爷[61, 37, 67]': 16,\n",
              " '汤师爷[22, 42, 68]': 17,\n",
              " '汤师爷[3, 43, 38]': 18,\n",
              " '汤师爷[8, 88, 48]': 19,\n",
              " '汤师爷[33, 90, 58]': 20,\n",
              " '汤师爷[86, 94, 93]': 21,\n",
              " '汤师爷[87, 18, 95]': 22,\n",
              " '汤师爷[92, 28, 97]': 23,\n",
              " '汤师爷[13, 89, 53]': 24,\n",
              " '汤师爷[23, 91, 96]': 25,\n",
              " '汤师爷[4, 99, 106]': 26,\n",
              " '汤师爷[24, 100, 107]': 27,\n",
              " '汤师爷[49, 105, 54]': 28,\n",
              " '汤师爷[98, 29, 101]': 29,\n",
              " '汤师爷[9, 34, 104]': 30,\n",
              " '汤师爷[14, 103, 108]': 31,\n",
              " '汤师爷[19, 44, 59]': 32,\n",
              " '汤师爷[39, 102, 109]': 33,\n",
              " '慕容复[20, 75, 77, 69]': 34,\n",
              " '慕容复[25, 40, 50, 70]': 35,\n",
              " '慕容复[30, 45, 55]': 36,\n",
              " '慕容复[35, 72, 73]': 37,\n",
              " '慕容复[71, 76, 74]': 38,\n",
              " '慕容复[1, 78, 36, 81]': 39,\n",
              " '慕容复[41, 21, 80, 85]': 40,\n",
              " '慕容复[82, 79, 84]': 41,\n",
              " '慕容复[6, 83, 46]': 42,\n",
              " '慕容复[11, 26, 51]': 43,\n",
              " '慕容复[17, 31, 56]': 44,\n",
              " '慕容复[2, 62, 47]': 45,\n",
              " '慕容复[7, 27, 65]': 46,\n",
              " '慕容复[12, 32, 66]': 47,\n",
              " '慕容复[16, 63, 52]': 48,\n",
              " '慕容复[60, 64, 57]': 49,\n",
              " '慕容复[61, 37, 67]': 50,\n",
              " '慕容复[22, 42, 68]': 51,\n",
              " '慕容复[3, 43, 38]': 52,\n",
              " '慕容复[8, 88, 48]': 53,\n",
              " '慕容复[33, 90, 58]': 54,\n",
              " '慕容复[86, 94, 93]': 55,\n",
              " '慕容复[87, 18, 95]': 56,\n",
              " '慕容复[92, 28, 97]': 57,\n",
              " '慕容复[13, 89, 53]': 58,\n",
              " '慕容复[23, 91, 96]': 59,\n",
              " '慕容复[4, 99, 106]': 60,\n",
              " '慕容复[24, 100, 107]': 61,\n",
              " '慕容复[49, 105, 54]': 62,\n",
              " '慕容复[98, 29, 101]': 63,\n",
              " '慕容复[9, 34, 104]': 64,\n",
              " '慕容复[14, 103, 108]': 65,\n",
              " '慕容复[19, 44, 59]': 66,\n",
              " '慕容复[39, 102, 109]': 67,\n",
              " '李云龙[20, 75, 77, 69]': 68,\n",
              " '李云龙[25, 40, 50, 70]': 69,\n",
              " '李云龙[30, 45, 55]': 70,\n",
              " '李云龙[35, 72, 73]': 71,\n",
              " '李云龙[71, 76, 74]': 72,\n",
              " '李云龙[1, 78, 36, 81]': 73,\n",
              " '李云龙[41, 21, 80, 85]': 74,\n",
              " '李云龙[82, 79, 84]': 75,\n",
              " '李云龙[6, 83, 46]': 76,\n",
              " '李云龙[11, 26, 51]': 77,\n",
              " '李云龙[17, 31, 56]': 78,\n",
              " '李云龙[2, 62, 47]': 79,\n",
              " '李云龙[7, 27, 65]': 80,\n",
              " '李云龙[12, 32, 66]': 81,\n",
              " '李云龙[16, 63, 52]': 82,\n",
              " '李云龙[60, 64, 57]': 83,\n",
              " '李云龙[61, 37, 67]': 84,\n",
              " '李云龙[22, 42, 68]': 85,\n",
              " '李云龙[3, 43, 38]': 86,\n",
              " '李云龙[8, 88, 48]': 87,\n",
              " '李云龙[33, 90, 58]': 88,\n",
              " '李云龙[86, 94, 93]': 89,\n",
              " '李云龙[87, 18, 95]': 90,\n",
              " '李云龙[92, 28, 97]': 91,\n",
              " '李云龙[13, 89, 53]': 92,\n",
              " '李云龙[23, 91, 96]': 93,\n",
              " '李云龙[4, 99, 106]': 94,\n",
              " '李云龙[24, 100, 107]': 95,\n",
              " '李云龙[49, 105, 54]': 96,\n",
              " '李云龙[98, 29, 101]': 97,\n",
              " '李云龙[9, 34, 104]': 98,\n",
              " '李云龙[14, 103, 108]': 99,\n",
              " '李云龙[19, 44, 59]': 100,\n",
              " '李云龙[39, 102, 109]': 101,\n",
              " 'Luna[20, 75, 77, 69]': 102,\n",
              " 'Luna[25, 40, 50, 70]': 103,\n",
              " 'Luna[30, 45, 55]': 104,\n",
              " 'Luna[35, 72, 73]': 105,\n",
              " 'Luna[71, 76, 74]': 106,\n",
              " 'Luna[1, 78, 36, 81]': 107,\n",
              " 'Luna[41, 21, 80, 85]': 108,\n",
              " 'Luna[82, 79, 84]': 109,\n",
              " 'Luna[6, 83, 46]': 110,\n",
              " 'Luna[11, 26, 51]': 111,\n",
              " 'Luna[17, 31, 56]': 112,\n",
              " 'Luna[2, 62, 47]': 113,\n",
              " 'Luna[7, 27, 65]': 114,\n",
              " 'Luna[12, 32, 66]': 115,\n",
              " 'Luna[16, 63, 52]': 116,\n",
              " 'Luna[60, 64, 57]': 117,\n",
              " 'Luna[61, 37, 67]': 118,\n",
              " 'Luna[22, 42, 68]': 119,\n",
              " 'Luna[3, 43, 38]': 120,\n",
              " 'Luna[8, 88, 48]': 121,\n",
              " 'Luna[33, 90, 58]': 122,\n",
              " 'Luna[86, 94, 93]': 123,\n",
              " 'Luna[87, 18, 95]': 124,\n",
              " 'Luna[92, 28, 97]': 125,\n",
              " 'Luna[13, 89, 53]': 126,\n",
              " 'Luna[23, 91, 96]': 127,\n",
              " 'Luna[4, 99, 106]': 128,\n",
              " 'Luna[24, 100, 107]': 129,\n",
              " 'Luna[49, 105, 54]': 130,\n",
              " 'Luna[98, 29, 101]': 131,\n",
              " 'Luna[9, 34, 104]': 132,\n",
              " 'Luna[14, 103, 108]': 133,\n",
              " 'Luna[19, 44, 59]': 134,\n",
              " 'Luna[39, 102, 109]': 135,\n",
              " '王多鱼[20, 75, 77, 69]': 136,\n",
              " '王多鱼[25, 40, 50, 70]': 137,\n",
              " '王多鱼[30, 45, 55]': 138,\n",
              " '王多鱼[35, 72, 73]': 139,\n",
              " '王多鱼[71, 76, 74]': 140,\n",
              " '王多鱼[1, 78, 36, 81]': 141,\n",
              " '王多鱼[41, 21, 80, 85]': 142,\n",
              " '王多鱼[82, 79, 84]': 143,\n",
              " '王多鱼[6, 83, 46]': 144,\n",
              " '王多鱼[11, 26, 51]': 145,\n",
              " '王多鱼[17, 31, 56]': 146,\n",
              " '王多鱼[2, 62, 47]': 147,\n",
              " '王多鱼[7, 27, 65]': 148,\n",
              " '王多鱼[12, 32, 66]': 149,\n",
              " '王多鱼[16, 63, 52]': 150,\n",
              " '王多鱼[60, 64, 57]': 151,\n",
              " '王多鱼[61, 37, 67]': 152,\n",
              " '王多鱼[22, 42, 68]': 153,\n",
              " '王多鱼[3, 43, 38]': 154,\n",
              " '王多鱼[8, 88, 48]': 155,\n",
              " '王多鱼[33, 90, 58]': 156,\n",
              " '王多鱼[86, 94, 93]': 157,\n",
              " '王多鱼[87, 18, 95]': 158,\n",
              " '王多鱼[92, 28, 97]': 159,\n",
              " '王多鱼[13, 89, 53]': 160,\n",
              " '王多鱼[23, 91, 96]': 161,\n",
              " '王多鱼[4, 99, 106]': 162,\n",
              " '王多鱼[24, 100, 107]': 163,\n",
              " '王多鱼[49, 105, 54]': 164,\n",
              " '王多鱼[98, 29, 101]': 165,\n",
              " '王多鱼[9, 34, 104]': 166,\n",
              " '王多鱼[14, 103, 108]': 167,\n",
              " '王多鱼[19, 44, 59]': 168,\n",
              " '王多鱼[39, 102, 109]': 169,\n",
              " 'Ron[20, 75, 77, 69]': 170,\n",
              " 'Ron[25, 40, 50, 70]': 171,\n",
              " 'Ron[30, 45, 55]': 172,\n",
              " 'Ron[35, 72, 73]': 173,\n",
              " 'Ron[71, 76, 74]': 174,\n",
              " 'Ron[1, 78, 36, 81]': 175,\n",
              " 'Ron[41, 21, 80, 85]': 176,\n",
              " 'Ron[82, 79, 84]': 177,\n",
              " 'Ron[6, 83, 46]': 178,\n",
              " 'Ron[11, 26, 51]': 179,\n",
              " 'Ron[17, 31, 56]': 180,\n",
              " 'Ron[2, 62, 47]': 181,\n",
              " 'Ron[7, 27, 65]': 182,\n",
              " 'Ron[12, 32, 66]': 183,\n",
              " 'Ron[16, 63, 52]': 184,\n",
              " 'Ron[60, 64, 57]': 185,\n",
              " 'Ron[61, 37, 67]': 186,\n",
              " 'Ron[22, 42, 68]': 187,\n",
              " 'Ron[3, 43, 38]': 188,\n",
              " 'Ron[8, 88, 48]': 189,\n",
              " 'Ron[33, 90, 58]': 190,\n",
              " 'Ron[86, 94, 93]': 191,\n",
              " 'Ron[87, 18, 95]': 192,\n",
              " 'Ron[92, 28, 97]': 193,\n",
              " 'Ron[13, 89, 53]': 194,\n",
              " 'Ron[23, 91, 96]': 195,\n",
              " 'Ron[4, 99, 106]': 196,\n",
              " 'Ron[24, 100, 107]': 197,\n",
              " 'Ron[49, 105, 54]': 198,\n",
              " 'Ron[98, 29, 101]': 199,\n",
              " 'Ron[9, 34, 104]': 200,\n",
              " 'Ron[14, 103, 108]': 201,\n",
              " 'Ron[19, 44, 59]': 202,\n",
              " 'Ron[39, 102, 109]': 203,\n",
              " '鸠摩智[20, 75, 77, 69]': 204,\n",
              " '鸠摩智[25, 40, 50, 70]': 205,\n",
              " '鸠摩智[30, 45, 55]': 206,\n",
              " '鸠摩智[35, 72, 73]': 207,\n",
              " '鸠摩智[71, 76, 74]': 208,\n",
              " '鸠摩智[1, 78, 36, 81]': 209,\n",
              " '鸠摩智[41, 21, 80, 85]': 210,\n",
              " '鸠摩智[82, 79, 84]': 211,\n",
              " '鸠摩智[6, 83, 46]': 212,\n",
              " '鸠摩智[11, 26, 51]': 213,\n",
              " '鸠摩智[17, 31, 56]': 214,\n",
              " '鸠摩智[2, 62, 47]': 215,\n",
              " '鸠摩智[7, 27, 65]': 216,\n",
              " '鸠摩智[12, 32, 66]': 217,\n",
              " '鸠摩智[16, 63, 52]': 218,\n",
              " '鸠摩智[60, 64, 57]': 219,\n",
              " '鸠摩智[61, 37, 67]': 220,\n",
              " '鸠摩智[22, 42, 68]': 221,\n",
              " '鸠摩智[3, 43, 38]': 222,\n",
              " '鸠摩智[8, 88, 48]': 223,\n",
              " '鸠摩智[33, 90, 58]': 224,\n",
              " '鸠摩智[86, 94, 93]': 225,\n",
              " '鸠摩智[87, 18, 95]': 226,\n",
              " '鸠摩智[92, 28, 97]': 227,\n",
              " '鸠摩智[13, 89, 53]': 228,\n",
              " '鸠摩智[23, 91, 96]': 229,\n",
              " '鸠摩智[4, 99, 106]': 230,\n",
              " '鸠摩智[24, 100, 107]': 231,\n",
              " '鸠摩智[49, 105, 54]': 232,\n",
              " '鸠摩智[98, 29, 101]': 233,\n",
              " '鸠摩智[9, 34, 104]': 234,\n",
              " '鸠摩智[14, 103, 108]': 235,\n",
              " '鸠摩智[19, 44, 59]': 236,\n",
              " '鸠摩智[39, 102, 109]': 237,\n",
              " 'Snape[20, 75, 77, 69]': 238,\n",
              " 'Snape[25, 40, 50, 70]': 239,\n",
              " 'Snape[30, 45, 55]': 240,\n",
              " 'Snape[35, 72, 73]': 241,\n",
              " 'Snape[71, 76, 74]': 242,\n",
              " 'Snape[1, 78, 36, 81]': 243,\n",
              " 'Snape[41, 21, 80, 85]': 244,\n",
              " 'Snape[82, 79, 84]': 245,\n",
              " 'Snape[6, 83, 46]': 246,\n",
              " 'Snape[11, 26, 51]': 247,\n",
              " 'Snape[17, 31, 56]': 248,\n",
              " 'Snape[2, 62, 47]': 249,\n",
              " 'Snape[7, 27, 65]': 250,\n",
              " 'Snape[12, 32, 66]': 251,\n",
              " 'Snape[16, 63, 52]': 252,\n",
              " 'Snape[60, 64, 57]': 253,\n",
              " 'Snape[61, 37, 67]': 254,\n",
              " 'Snape[22, 42, 68]': 255,\n",
              " 'Snape[3, 43, 38]': 256,\n",
              " 'Snape[8, 88, 48]': 257,\n",
              " 'Snape[33, 90, 58]': 258,\n",
              " 'Snape[86, 94, 93]': 259,\n",
              " 'Snape[87, 18, 95]': 260,\n",
              " 'Snape[92, 28, 97]': 261,\n",
              " 'Snape[13, 89, 53]': 262,\n",
              " 'Snape[23, 91, 96]': 263,\n",
              " 'Snape[4, 99, 106]': 264,\n",
              " 'Snape[24, 100, 107]': 265,\n",
              " 'Snape[49, 105, 54]': 266,\n",
              " 'Snape[98, 29, 101]': 267,\n",
              " 'Snape[9, 34, 104]': 268,\n",
              " 'Snape[14, 103, 108]': 269,\n",
              " 'Snape[19, 44, 59]': 270,\n",
              " 'Snape[39, 102, 109]': 271,\n",
              " '凉宫春日[20, 75, 77, 69]': 272,\n",
              " '凉宫春日[25, 40, 50, 70]': 273,\n",
              " '凉宫春日[30, 45, 55]': 274,\n",
              " '凉宫春日[35, 72, 73]': 275,\n",
              " '凉宫春日[71, 76, 74]': 276,\n",
              " '凉宫春日[1, 78, 36, 81]': 277,\n",
              " '凉宫春日[41, 21, 80, 85]': 278,\n",
              " '凉宫春日[82, 79, 84]': 279,\n",
              " '凉宫春日[6, 83, 46]': 280,\n",
              " '凉宫春日[11, 26, 51]': 281,\n",
              " '凉宫春日[17, 31, 56]': 282,\n",
              " '凉宫春日[2, 62, 47]': 283,\n",
              " '凉宫春日[7, 27, 65]': 284,\n",
              " '凉宫春日[12, 32, 66]': 285,\n",
              " '凉宫春日[16, 63, 52]': 286,\n",
              " '凉宫春日[60, 64, 57]': 287,\n",
              " '凉宫春日[61, 37, 67]': 288,\n",
              " '凉宫春日[22, 42, 68]': 289,\n",
              " '凉宫春日[3, 43, 38]': 290,\n",
              " '凉宫春日[8, 88, 48]': 291,\n",
              " '凉宫春日[33, 90, 58]': 292,\n",
              " '凉宫春日[86, 94, 93]': 293,\n",
              " '凉宫春日[87, 18, 95]': 294,\n",
              " '凉宫春日[92, 28, 97]': 295,\n",
              " '凉宫春日[13, 89, 53]': 296,\n",
              " '凉宫春日[23, 91, 96]': 297,\n",
              " '凉宫春日[4, 99, 106]': 298,\n",
              " '凉宫春日[24, 100, 107]': 299,\n",
              " '凉宫春日[49, 105, 54]': 300,\n",
              " '凉宫春日[98, 29, 101]': 301,\n",
              " '凉宫春日[9, 34, 104]': 302,\n",
              " '凉宫春日[14, 103, 108]': 303,\n",
              " '凉宫春日[19, 44, 59]': 304,\n",
              " '凉宫春日[39, 102, 109]': 305,\n",
              " 'Malfoy[20, 75, 77, 69]': 306,\n",
              " 'Malfoy[25, 40, 50, 70]': 307,\n",
              " 'Malfoy[30, 45, 55]': 308,\n",
              " 'Malfoy[35, 72, 73]': 309,\n",
              " 'Malfoy[71, 76, 74]': 310,\n",
              " 'Malfoy[1, 78, 36, 81]': 311,\n",
              " 'Malfoy[41, 21, 80, 85]': 312,\n",
              " 'Malfoy[82, 79, 84]': 313,\n",
              " 'Malfoy[6, 83, 46]': 314,\n",
              " 'Malfoy[11, 26, 51]': 315,\n",
              " 'Malfoy[17, 31, 56]': 316,\n",
              " 'Malfoy[2, 62, 47]': 317,\n",
              " 'Malfoy[7, 27, 65]': 318,\n",
              " 'Malfoy[12, 32, 66]': 319,\n",
              " 'Malfoy[16, 63, 52]': 320,\n",
              " 'Malfoy[60, 64, 57]': 321,\n",
              " 'Malfoy[61, 37, 67]': 322,\n",
              " 'Malfoy[22, 42, 68]': 323,\n",
              " 'Malfoy[3, 43, 38]': 324,\n",
              " 'Malfoy[8, 88, 48]': 325,\n",
              " 'Malfoy[33, 90, 58]': 326,\n",
              " 'Malfoy[86, 94, 93]': 327,\n",
              " 'Malfoy[87, 18, 95]': 328,\n",
              " 'Malfoy[92, 28, 97]': 329,\n",
              " 'Malfoy[13, 89, 53]': 330,\n",
              " 'Malfoy[23, 91, 96]': 331,\n",
              " 'Malfoy[4, 99, 106]': 332,\n",
              " 'Malfoy[24, 100, 107]': 333,\n",
              " 'Malfoy[49, 105, 54]': 334,\n",
              " 'Malfoy[98, 29, 101]': 335,\n",
              " 'Malfoy[9, 34, 104]': 336,\n",
              " 'Malfoy[14, 103, 108]': 337,\n",
              " 'Malfoy[19, 44, 59]': 338,\n",
              " 'Malfoy[39, 102, 109]': 339,\n",
              " '虚竹[20, 75, 77, 69]': 340,\n",
              " '虚竹[25, 40, 50, 70]': 341,\n",
              " '虚竹[30, 45, 55]': 342,\n",
              " '虚竹[35, 72, 73]': 343,\n",
              " '虚竹[71, 76, 74]': 344,\n",
              " '虚竹[1, 78, 36, 81]': 345,\n",
              " '虚竹[41, 21, 80, 85]': 346,\n",
              " '虚竹[82, 79, 84]': 347,\n",
              " '虚竹[6, 83, 46]': 348,\n",
              " '虚竹[11, 26, 51]': 349,\n",
              " '虚竹[17, 31, 56]': 350,\n",
              " '虚竹[2, 62, 47]': 351,\n",
              " '虚竹[7, 27, 65]': 352,\n",
              " '虚竹[12, 32, 66]': 353,\n",
              " '虚竹[16, 63, 52]': 354,\n",
              " '虚竹[60, 64, 57]': 355,\n",
              " '虚竹[61, 37, 67]': 356,\n",
              " '虚竹[22, 42, 68]': 357,\n",
              " '虚竹[3, 43, 38]': 358,\n",
              " '虚竹[8, 88, 48]': 359,\n",
              " '虚竹[33, 90, 58]': 360,\n",
              " '虚竹[86, 94, 93]': 361,\n",
              " '虚竹[87, 18, 95]': 362,\n",
              " '虚竹[92, 28, 97]': 363,\n",
              " '虚竹[13, 89, 53]': 364,\n",
              " '虚竹[23, 91, 96]': 365,\n",
              " '虚竹[4, 99, 106]': 366,\n",
              " '虚竹[24, 100, 107]': 367,\n",
              " '虚竹[49, 105, 54]': 368,\n",
              " '虚竹[98, 29, 101]': 369,\n",
              " '虚竹[9, 34, 104]': 370,\n",
              " '虚竹[14, 103, 108]': 371,\n",
              " '虚竹[19, 44, 59]': 372,\n",
              " '虚竹[39, 102, 109]': 373,\n",
              " '萧峰[20, 75, 77, 69]': 374,\n",
              " '萧峰[25, 40, 50, 70]': 375,\n",
              " '萧峰[30, 45, 55]': 376,\n",
              " '萧峰[35, 72, 73]': 377,\n",
              " '萧峰[71, 76, 74]': 378,\n",
              " '萧峰[1, 78, 36, 81]': 379,\n",
              " '萧峰[41, 21, 80, 85]': 380,\n",
              " '萧峰[82, 79, 84]': 381,\n",
              " '萧峰[6, 83, 46]': 382,\n",
              " '萧峰[11, 26, 51]': 383,\n",
              " '萧峰[17, 31, 56]': 384,\n",
              " '萧峰[2, 62, 47]': 385,\n",
              " '萧峰[7, 27, 65]': 386,\n",
              " '萧峰[12, 32, 66]': 387,\n",
              " '萧峰[16, 63, 52]': 388,\n",
              " '萧峰[60, 64, 57]': 389,\n",
              " '萧峰[61, 37, 67]': 390,\n",
              " '萧峰[22, 42, 68]': 391,\n",
              " '萧峰[3, 43, 38]': 392,\n",
              " '萧峰[8, 88, 48]': 393,\n",
              " '萧峰[33, 90, 58]': 394,\n",
              " '萧峰[86, 94, 93]': 395,\n",
              " '萧峰[87, 18, 95]': 396,\n",
              " '萧峰[92, 28, 97]': 397,\n",
              " '萧峰[13, 89, 53]': 398,\n",
              " '萧峰[23, 91, 96]': 399,\n",
              " '萧峰[4, 99, 106]': 400,\n",
              " '萧峰[24, 100, 107]': 401,\n",
              " '萧峰[49, 105, 54]': 402,\n",
              " '萧峰[98, 29, 101]': 403,\n",
              " '萧峰[9, 34, 104]': 404,\n",
              " '萧峰[14, 103, 108]': 405,\n",
              " '萧峰[19, 44, 59]': 406,\n",
              " '萧峰[39, 102, 109]': 407,\n",
              " '段誉[20, 75, 77, 69]': 408,\n",
              " '段誉[25, 40, 50, 70]': 409,\n",
              " '段誉[30, 45, 55]': 410,\n",
              " '段誉[35, 72, 73]': 411,\n",
              " '段誉[71, 76, 74]': 412,\n",
              " '段誉[1, 78, 36, 81]': 413,\n",
              " '段誉[41, 21, 80, 85]': 414,\n",
              " '段誉[82, 79, 84]': 415,\n",
              " '段誉[6, 83, 46]': 416,\n",
              " '段誉[11, 26, 51]': 417,\n",
              " '段誉[17, 31, 56]': 418,\n",
              " '段誉[2, 62, 47]': 419,\n",
              " '段誉[7, 27, 65]': 420,\n",
              " '段誉[12, 32, 66]': 421,\n",
              " '段誉[16, 63, 52]': 422,\n",
              " '段誉[60, 64, 57]': 423,\n",
              " '段誉[61, 37, 67]': 424,\n",
              " '段誉[22, 42, 68]': 425,\n",
              " '段誉[3, 43, 38]': 426,\n",
              " '段誉[8, 88, 48]': 427,\n",
              " '段誉[33, 90, 58]': 428,\n",
              " '段誉[86, 94, 93]': 429,\n",
              " '段誉[87, 18, 95]': 430,\n",
              " '段誉[92, 28, 97]': 431,\n",
              " '段誉[13, 89, 53]': 432,\n",
              " '段誉[23, 91, 96]': 433,\n",
              " '段誉[4, 99, 106]': 434,\n",
              " '段誉[24, 100, 107]': 435,\n",
              " '段誉[49, 105, 54]': 436,\n",
              " '段誉[98, 29, 101]': 437,\n",
              " '段誉[9, 34, 104]': 438,\n",
              " '段誉[14, 103, 108]': 439,\n",
              " '段誉[19, 44, 59]': 440,\n",
              " '段誉[39, 102, 109]': 441,\n",
              " 'Hermione[20, 75, 77, 69]': 442,\n",
              " 'Hermione[25, 40, 50, 70]': 443,\n",
              " 'Hermione[30, 45, 55]': 444,\n",
              " 'Hermione[35, 72, 73]': 445,\n",
              " 'Hermione[71, 76, 74]': 446,\n",
              " 'Hermione[1, 78, 36, 81]': 447,\n",
              " 'Hermione[41, 21, 80, 85]': 448,\n",
              " 'Hermione[82, 79, 84]': 449,\n",
              " 'Hermione[6, 83, 46]': 450,\n",
              " 'Hermione[11, 26, 51]': 451,\n",
              " 'Hermione[17, 31, 56]': 452,\n",
              " 'Hermione[2, 62, 47]': 453,\n",
              " 'Hermione[7, 27, 65]': 454,\n",
              " 'Hermione[12, 32, 66]': 455,\n",
              " 'Hermione[16, 63, 52]': 456,\n",
              " 'Hermione[60, 64, 57]': 457,\n",
              " 'Hermione[61, 37, 67]': 458,\n",
              " 'Hermione[22, 42, 68]': 459,\n",
              " 'Hermione[3, 43, 38]': 460,\n",
              " 'Hermione[8, 88, 48]': 461,\n",
              " 'Hermione[33, 90, 58]': 462,\n",
              " 'Hermione[86, 94, 93]': 463,\n",
              " 'Hermione[87, 18, 95]': 464,\n",
              " 'Hermione[92, 28, 97]': 465,\n",
              " 'Hermione[13, 89, 53]': 466,\n",
              " 'Hermione[23, 91, 96]': 467,\n",
              " 'Hermione[4, 99, 106]': 468,\n",
              " 'Hermione[24, 100, 107]': 469,\n",
              " 'Hermione[49, 105, 54]': 470,\n",
              " 'Hermione[98, 29, 101]': 471,\n",
              " 'Hermione[9, 34, 104]': 472,\n",
              " 'Hermione[14, 103, 108]': 473,\n",
              " 'Hermione[19, 44, 59]': 474,\n",
              " 'Hermione[39, 102, 109]': 475,\n",
              " 'Dumbledore[20, 75, 77, 69]': 476,\n",
              " 'Dumbledore[25, 40, 50, 70]': 477,\n",
              " 'Dumbledore[30, 45, 55]': 478,\n",
              " 'Dumbledore[35, 72, 73]': 479,\n",
              " 'Dumbledore[71, 76, 74]': 480,\n",
              " 'Dumbledore[1, 78, 36, 81]': 481,\n",
              " 'Dumbledore[41, 21, 80, 85]': 482,\n",
              " 'Dumbledore[82, 79, 84]': 483,\n",
              " 'Dumbledore[6, 83, 46]': 484,\n",
              " 'Dumbledore[11, 26, 51]': 485,\n",
              " 'Dumbledore[17, 31, 56]': 486,\n",
              " 'Dumbledore[2, 62, 47]': 487,\n",
              " 'Dumbledore[7, 27, 65]': 488,\n",
              " 'Dumbledore[12, 32, 66]': 489,\n",
              " 'Dumbledore[16, 63, 52]': 490,\n",
              " 'Dumbledore[60, 64, 57]': 491,\n",
              " 'Dumbledore[61, 37, 67]': 492,\n",
              " 'Dumbledore[22, 42, 68]': 493,\n",
              " 'Dumbledore[3, 43, 38]': 494,\n",
              " 'Dumbledore[8, 88, 48]': 495,\n",
              " 'Dumbledore[33, 90, 58]': 496,\n",
              " 'Dumbledore[86, 94, 93]': 497,\n",
              " 'Dumbledore[87, 18, 95]': 498,\n",
              " 'Dumbledore[92, 28, 97]': 499,\n",
              " 'Dumbledore[13, 89, 53]': 500,\n",
              " 'Dumbledore[23, 91, 96]': 501,\n",
              " 'Dumbledore[4, 99, 106]': 502,\n",
              " 'Dumbledore[24, 100, 107]': 503,\n",
              " 'Dumbledore[49, 105, 54]': 504,\n",
              " 'Dumbledore[98, 29, 101]': 505,\n",
              " 'Dumbledore[9, 34, 104]': 506,\n",
              " 'Dumbledore[14, 103, 108]': 507,\n",
              " 'Dumbledore[19, 44, 59]': 508,\n",
              " 'Dumbledore[39, 102, 109]': 509,\n",
              " '王语嫣[20, 75, 77, 69]': 510,\n",
              " '王语嫣[25, 40, 50, 70]': 511,\n",
              " '王语嫣[30, 45, 55]': 512,\n",
              " '王语嫣[35, 72, 73]': 513,\n",
              " '王语嫣[71, 76, 74]': 514,\n",
              " '王语嫣[1, 78, 36, 81]': 515,\n",
              " '王语嫣[41, 21, 80, 85]': 516,\n",
              " '王语嫣[82, 79, 84]': 517,\n",
              " '王语嫣[6, 83, 46]': 518,\n",
              " '王语嫣[11, 26, 51]': 519,\n",
              " '王语嫣[17, 31, 56]': 520,\n",
              " '王语嫣[2, 62, 47]': 521,\n",
              " '王语嫣[7, 27, 65]': 522,\n",
              " '王语嫣[12, 32, 66]': 523,\n",
              " '王语嫣[16, 63, 52]': 524,\n",
              " '王语嫣[60, 64, 57]': 525,\n",
              " '王语嫣[61, 37, 67]': 526,\n",
              " '王语嫣[22, 42, 68]': 527,\n",
              " '王语嫣[3, 43, 38]': 528,\n",
              " '王语嫣[8, 88, 48]': 529,\n",
              " '王语嫣[33, 90, 58]': 530,\n",
              " '王语嫣[86, 94, 93]': 531,\n",
              " '王语嫣[87, 18, 95]': 532,\n",
              " '王语嫣[92, 28, 97]': 533,\n",
              " '王语嫣[13, 89, 53]': 534,\n",
              " '王语嫣[23, 91, 96]': 535,\n",
              " '王语嫣[4, 99, 106]': 536,\n",
              " '王语嫣[24, 100, 107]': 537,\n",
              " '王语嫣[49, 105, 54]': 538,\n",
              " '王语嫣[98, 29, 101]': 539,\n",
              " '王语嫣[9, 34, 104]': 540,\n",
              " '王语嫣[14, 103, 108]': 541,\n",
              " '王语嫣[19, 44, 59]': 542,\n",
              " '王语嫣[39, 102, 109]': 543,\n",
              " 'Harry[20, 75, 77, 69]': 544,\n",
              " 'Harry[25, 40, 50, 70]': 545,\n",
              " 'Harry[30, 45, 55]': 546,\n",
              " 'Harry[35, 72, 73]': 547,\n",
              " 'Harry[71, 76, 74]': 548,\n",
              " 'Harry[1, 78, 36, 81]': 549,\n",
              " 'Harry[41, 21, 80, 85]': 550,\n",
              " 'Harry[82, 79, 84]': 551,\n",
              " 'Harry[6, 83, 46]': 552,\n",
              " 'Harry[11, 26, 51]': 553,\n",
              " 'Harry[17, 31, 56]': 554,\n",
              " 'Harry[2, 62, 47]': 555,\n",
              " 'Harry[7, 27, 65]': 556,\n",
              " 'Harry[12, 32, 66]': 557,\n",
              " 'Harry[16, 63, 52]': 558,\n",
              " 'Harry[60, 64, 57]': 559,\n",
              " 'Harry[61, 37, 67]': 560,\n",
              " 'Harry[22, 42, 68]': 561,\n",
              " 'Harry[3, 43, 38]': 562,\n",
              " 'Harry[8, 88, 48]': 563,\n",
              " 'Harry[33, 90, 58]': 564,\n",
              " 'Harry[86, 94, 93]': 565,\n",
              " 'Harry[87, 18, 95]': 566,\n",
              " 'Harry[92, 28, 97]': 567,\n",
              " 'Harry[13, 89, 53]': 568,\n",
              " 'Harry[23, 91, 96]': 569,\n",
              " 'Harry[4, 99, 106]': 570,\n",
              " 'Harry[24, 100, 107]': 571,\n",
              " 'Harry[49, 105, 54]': 572,\n",
              " 'Harry[98, 29, 101]': 573,\n",
              " 'Harry[9, 34, 104]': 574,\n",
              " 'Harry[14, 103, 108]': 575,\n",
              " 'Harry[19, 44, 59]': 576,\n",
              " 'Harry[39, 102, 109]': 577,\n",
              " 'McGonagall[20, 75, 77, 69]': 578,\n",
              " 'McGonagall[25, 40, 50, 70]': 579,\n",
              " 'McGonagall[30, 45, 55]': 580,\n",
              " 'McGonagall[35, 72, 73]': 581,\n",
              " 'McGonagall[71, 76, 74]': 582,\n",
              " 'McGonagall[1, 78, 36, 81]': 583,\n",
              " 'McGonagall[41, 21, 80, 85]': 584,\n",
              " 'McGonagall[82, 79, 84]': 585,\n",
              " 'McGonagall[6, 83, 46]': 586,\n",
              " 'McGonagall[11, 26, 51]': 587,\n",
              " 'McGonagall[17, 31, 56]': 588,\n",
              " 'McGonagall[2, 62, 47]': 589,\n",
              " 'McGonagall[7, 27, 65]': 590,\n",
              " 'McGonagall[12, 32, 66]': 591,\n",
              " 'McGonagall[16, 63, 52]': 592,\n",
              " 'McGonagall[60, 64, 57]': 593,\n",
              " 'McGonagall[61, 37, 67]': 594,\n",
              " 'McGonagall[22, 42, 68]': 595,\n",
              " 'McGonagall[3, 43, 38]': 596,\n",
              " 'McGonagall[8, 88, 48]': 597,\n",
              " 'McGonagall[33, 90, 58]': 598,\n",
              " 'McGonagall[86, 94, 93]': 599,\n",
              " 'McGonagall[87, 18, 95]': 600,\n",
              " 'McGonagall[92, 28, 97]': 601,\n",
              " 'McGonagall[13, 89, 53]': 602,\n",
              " 'McGonagall[23, 91, 96]': 603,\n",
              " 'McGonagall[4, 99, 106]': 604,\n",
              " 'McGonagall[24, 100, 107]': 605,\n",
              " 'McGonagall[49, 105, 54]': 606,\n",
              " 'McGonagall[98, 29, 101]': 607,\n",
              " 'McGonagall[9, 34, 104]': 608,\n",
              " 'McGonagall[14, 103, 108]': 609,\n",
              " 'McGonagall[19, 44, 59]': 610,\n",
              " 'McGonagall[39, 102, 109]': 611,\n",
              " '白展堂[20, 75, 77, 69]': 612,\n",
              " '白展堂[25, 40, 50, 70]': 613,\n",
              " '白展堂[30, 45, 55]': 614,\n",
              " '白展堂[35, 72, 73]': 615,\n",
              " '白展堂[71, 76, 74]': 616,\n",
              " '白展堂[1, 78, 36, 81]': 617,\n",
              " '白展堂[41, 21, 80, 85]': 618,\n",
              " '白展堂[82, 79, 84]': 619,\n",
              " '白展堂[6, 83, 46]': 620,\n",
              " '白展堂[11, 26, 51]': 621,\n",
              " '白展堂[17, 31, 56]': 622,\n",
              " '白展堂[2, 62, 47]': 623,\n",
              " '白展堂[7, 27, 65]': 624,\n",
              " '白展堂[12, 32, 66]': 625,\n",
              " '白展堂[16, 63, 52]': 626,\n",
              " '白展堂[60, 64, 57]': 627,\n",
              " '白展堂[61, 37, 67]': 628,\n",
              " '白展堂[22, 42, 68]': 629,\n",
              " '白展堂[3, 43, 38]': 630,\n",
              " '白展堂[8, 88, 48]': 631,\n",
              " '白展堂[33, 90, 58]': 632,\n",
              " '白展堂[86, 94, 93]': 633,\n",
              " '白展堂[87, 18, 95]': 634,\n",
              " '白展堂[92, 28, 97]': 635,\n",
              " '白展堂[13, 89, 53]': 636,\n",
              " '白展堂[23, 91, 96]': 637,\n",
              " '白展堂[4, 99, 106]': 638,\n",
              " '白展堂[24, 100, 107]': 639,\n",
              " '白展堂[49, 105, 54]': 640,\n",
              " '白展堂[98, 29, 101]': 641,\n",
              " '白展堂[9, 34, 104]': 642,\n",
              " '白展堂[14, 103, 108]': 643,\n",
              " '白展堂[19, 44, 59]': 644,\n",
              " '白展堂[39, 102, 109]': 645,\n",
              " '佟湘玉[20, 75, 77, 69]': 646,\n",
              " '佟湘玉[25, 40, 50, 70]': 647,\n",
              " '佟湘玉[30, 45, 55]': 648,\n",
              " '佟湘玉[35, 72, 73]': 649,\n",
              " '佟湘玉[71, 76, 74]': 650,\n",
              " '佟湘玉[1, 78, 36, 81]': 651,\n",
              " '佟湘玉[41, 21, 80, 85]': 652,\n",
              " '佟湘玉[82, 79, 84]': 653,\n",
              " '佟湘玉[6, 83, 46]': 654,\n",
              " '佟湘玉[11, 26, 51]': 655,\n",
              " '佟湘玉[17, 31, 56]': 656,\n",
              " '佟湘玉[2, 62, 47]': 657,\n",
              " '佟湘玉[7, 27, 65]': 658,\n",
              " '佟湘玉[12, 32, 66]': 659,\n",
              " '佟湘玉[16, 63, 52]': 660,\n",
              " '佟湘玉[60, 64, 57]': 661,\n",
              " '佟湘玉[61, 37, 67]': 662,\n",
              " '佟湘玉[22, 42, 68]': 663,\n",
              " '佟湘玉[3, 43, 38]': 664,\n",
              " '佟湘玉[8, 88, 48]': 665,\n",
              " '佟湘玉[33, 90, 58]': 666,\n",
              " '佟湘玉[86, 94, 93]': 667,\n",
              " '佟湘玉[87, 18, 95]': 668,\n",
              " '佟湘玉[92, 28, 97]': 669,\n",
              " '佟湘玉[13, 89, 53]': 670,\n",
              " '佟湘玉[23, 91, 96]': 671,\n",
              " '佟湘玉[4, 99, 106]': 672,\n",
              " '佟湘玉[24, 100, 107]': 673,\n",
              " '佟湘玉[49, 105, 54]': 674,\n",
              " '佟湘玉[98, 29, 101]': 675,\n",
              " '佟湘玉[9, 34, 104]': 676,\n",
              " '佟湘玉[14, 103, 108]': 677,\n",
              " '佟湘玉[19, 44, 59]': 678,\n",
              " '佟湘玉[39, 102, 109]': 679,\n",
              " '郭芙蓉[20, 75, 77, 69]': 680,\n",
              " '郭芙蓉[25, 40, 50, 70]': 681,\n",
              " '郭芙蓉[30, 45, 55]': 682,\n",
              " '郭芙蓉[35, 72, 73]': 683,\n",
              " '郭芙蓉[71, 76, 74]': 684,\n",
              " '郭芙蓉[1, 78, 36, 81]': 685,\n",
              " '郭芙蓉[41, 21, 80, 85]': 686,\n",
              " '郭芙蓉[82, 79, 84]': 687,\n",
              " '郭芙蓉[6, 83, 46]': 688,\n",
              " '郭芙蓉[11, 26, 51]': 689,\n",
              " '郭芙蓉[17, 31, 56]': 690,\n",
              " '郭芙蓉[2, 62, 47]': 691,\n",
              " '郭芙蓉[7, 27, 65]': 692,\n",
              " '郭芙蓉[12, 32, 66]': 693,\n",
              " '郭芙蓉[16, 63, 52]': 694,\n",
              " '郭芙蓉[60, 64, 57]': 695,\n",
              " '郭芙蓉[61, 37, 67]': 696,\n",
              " '郭芙蓉[22, 42, 68]': 697,\n",
              " '郭芙蓉[3, 43, 38]': 698,\n",
              " '郭芙蓉[8, 88, 48]': 699,\n",
              " '郭芙蓉[33, 90, 58]': 700,\n",
              " '郭芙蓉[86, 94, 93]': 701,\n",
              " '郭芙蓉[87, 18, 95]': 702,\n",
              " '郭芙蓉[92, 28, 97]': 703,\n",
              " '郭芙蓉[13, 89, 53]': 704,\n",
              " '郭芙蓉[23, 91, 96]': 705,\n",
              " '郭芙蓉[4, 99, 106]': 706,\n",
              " '郭芙蓉[24, 100, 107]': 707,\n",
              " '郭芙蓉[49, 105, 54]': 708,\n",
              " '郭芙蓉[98, 29, 101]': 709,\n",
              " '郭芙蓉[9, 34, 104]': 710,\n",
              " '郭芙蓉[14, 103, 108]': 711,\n",
              " '郭芙蓉[19, 44, 59]': 712,\n",
              " '郭芙蓉[39, 102, 109]': 713,\n",
              " '旅行者[20, 75, 77, 69]': 714,\n",
              " '旅行者[25, 40, 50, 70]': 715,\n",
              " '旅行者[30, 45, 55]': 716,\n",
              " '旅行者[35, 72, 73]': 717,\n",
              " '旅行者[71, 76, 74]': 718,\n",
              " '旅行者[1, 78, 36, 81]': 719,\n",
              " '旅行者[41, 21, 80, 85]': 720,\n",
              " '旅行者[82, 79, 84]': 721,\n",
              " '旅行者[6, 83, 46]': 722,\n",
              " '旅行者[11, 26, 51]': 723,\n",
              " '旅行者[17, 31, 56]': 724,\n",
              " '旅行者[2, 62, 47]': 725,\n",
              " '旅行者[7, 27, 65]': 726,\n",
              " '旅行者[12, 32, 66]': 727,\n",
              " '旅行者[16, 63, 52]': 728,\n",
              " '旅行者[60, 64, 57]': 729,\n",
              " '旅行者[61, 37, 67]': 730,\n",
              " '旅行者[22, 42, 68]': 731,\n",
              " '旅行者[3, 43, 38]': 732,\n",
              " '旅行者[8, 88, 48]': 733,\n",
              " '旅行者[33, 90, 58]': 734,\n",
              " '旅行者[86, 94, 93]': 735,\n",
              " '旅行者[87, 18, 95]': 736,\n",
              " '旅行者[92, 28, 97]': 737,\n",
              " '旅行者[13, 89, 53]': 738,\n",
              " '旅行者[23, 91, 96]': 739,\n",
              " '旅行者[4, 99, 106]': 740,\n",
              " '旅行者[24, 100, 107]': 741,\n",
              " '旅行者[49, 105, 54]': 742,\n",
              " '旅行者[98, 29, 101]': 743,\n",
              " '旅行者[9, 34, 104]': 744,\n",
              " '旅行者[14, 103, 108]': 745,\n",
              " '旅行者[19, 44, 59]': 746,\n",
              " '旅行者[39, 102, 109]': 747,\n",
              " '钟离[20, 75, 77, 69]': 748,\n",
              " '钟离[25, 40, 50, 70]': 749,\n",
              " '钟离[30, 45, 55]': 750,\n",
              " '钟离[35, 72, 73]': 751,\n",
              " '钟离[71, 76, 74]': 752,\n",
              " '钟离[1, 78, 36, 81]': 753,\n",
              " '钟离[41, 21, 80, 85]': 754,\n",
              " '钟离[82, 79, 84]': 755,\n",
              " '钟离[6, 83, 46]': 756,\n",
              " '钟离[11, 26, 51]': 757,\n",
              " '钟离[17, 31, 56]': 758,\n",
              " '钟离[2, 62, 47]': 759,\n",
              " '钟离[7, 27, 65]': 760,\n",
              " '钟离[12, 32, 66]': 761,\n",
              " '钟离[16, 63, 52]': 762,\n",
              " '钟离[60, 64, 57]': 763,\n",
              " '钟离[61, 37, 67]': 764,\n",
              " '钟离[22, 42, 68]': 765,\n",
              " '钟离[3, 43, 38]': 766,\n",
              " '钟离[8, 88, 48]': 767,\n",
              " '钟离[33, 90, 58]': 768,\n",
              " '钟离[86, 94, 93]': 769,\n",
              " '钟离[87, 18, 95]': 770,\n",
              " '钟离[92, 28, 97]': 771,\n",
              " '钟离[13, 89, 53]': 772,\n",
              " '钟离[23, 91, 96]': 773,\n",
              " '钟离[4, 99, 106]': 774,\n",
              " '钟离[24, 100, 107]': 775,\n",
              " '钟离[49, 105, 54]': 776,\n",
              " '钟离[98, 29, 101]': 777,\n",
              " '钟离[9, 34, 104]': 778,\n",
              " '钟离[14, 103, 108]': 779,\n",
              " '钟离[19, 44, 59]': 780,\n",
              " '钟离[39, 102, 109]': 781,\n",
              " '胡桃[20, 75, 77, 69]': 782,\n",
              " '胡桃[25, 40, 50, 70]': 783,\n",
              " '胡桃[30, 45, 55]': 784,\n",
              " '胡桃[35, 72, 73]': 785,\n",
              " '胡桃[71, 76, 74]': 786,\n",
              " '胡桃[1, 78, 36, 81]': 787,\n",
              " '胡桃[41, 21, 80, 85]': 788,\n",
              " '胡桃[82, 79, 84]': 789,\n",
              " '胡桃[6, 83, 46]': 790,\n",
              " '胡桃[11, 26, 51]': 791,\n",
              " '胡桃[17, 31, 56]': 792,\n",
              " '胡桃[2, 62, 47]': 793,\n",
              " '胡桃[7, 27, 65]': 794,\n",
              " '胡桃[12, 32, 66]': 795,\n",
              " '胡桃[16, 63, 52]': 796,\n",
              " '胡桃[60, 64, 57]': 797,\n",
              " '胡桃[61, 37, 67]': 798,\n",
              " '胡桃[22, 42, 68]': 799,\n",
              " '胡桃[3, 43, 38]': 800,\n",
              " '胡桃[8, 88, 48]': 801,\n",
              " '胡桃[33, 90, 58]': 802,\n",
              " '胡桃[86, 94, 93]': 803,\n",
              " '胡桃[87, 18, 95]': 804,\n",
              " '胡桃[92, 28, 97]': 805,\n",
              " '胡桃[13, 89, 53]': 806,\n",
              " '胡桃[23, 91, 96]': 807,\n",
              " '胡桃[4, 99, 106]': 808,\n",
              " '胡桃[24, 100, 107]': 809,\n",
              " '胡桃[49, 105, 54]': 810,\n",
              " '胡桃[98, 29, 101]': 811,\n",
              " '胡桃[9, 34, 104]': 812,\n",
              " '胡桃[14, 103, 108]': 813,\n",
              " '胡桃[19, 44, 59]': 814,\n",
              " '胡桃[39, 102, 109]': 815,\n",
              " 'Sheldon[20, 75, 77, 69]': 816,\n",
              " 'Sheldon[25, 40, 50, 70]': 817,\n",
              " 'Sheldon[30, 45, 55]': 818,\n",
              " 'Sheldon[35, 72, 73]': 819,\n",
              " 'Sheldon[71, 76, 74]': 820,\n",
              " 'Sheldon[1, 78, 36, 81]': 821,\n",
              " 'Sheldon[41, 21, 80, 85]': 822,\n",
              " 'Sheldon[82, 79, 84]': 823,\n",
              " 'Sheldon[6, 83, 46]': 824,\n",
              " 'Sheldon[11, 26, 51]': 825,\n",
              " 'Sheldon[17, 31, 56]': 826,\n",
              " 'Sheldon[2, 62, 47]': 827,\n",
              " 'Sheldon[7, 27, 65]': 828,\n",
              " 'Sheldon[12, 32, 66]': 829,\n",
              " 'Sheldon[16, 63, 52]': 830,\n",
              " 'Sheldon[60, 64, 57]': 831,\n",
              " 'Sheldon[61, 37, 67]': 832,\n",
              " 'Sheldon[22, 42, 68]': 833,\n",
              " 'Sheldon[3, 43, 38]': 834,\n",
              " 'Sheldon[8, 88, 48]': 835,\n",
              " 'Sheldon[33, 90, 58]': 836,\n",
              " 'Sheldon[86, 94, 93]': 837,\n",
              " 'Sheldon[87, 18, 95]': 838,\n",
              " 'Sheldon[92, 28, 97]': 839,\n",
              " 'Sheldon[13, 89, 53]': 840,\n",
              " 'Sheldon[23, 91, 96]': 841,\n",
              " 'Sheldon[4, 99, 106]': 842,\n",
              " 'Sheldon[24, 100, 107]': 843,\n",
              " 'Sheldon[49, 105, 54]': 844,\n",
              " 'Sheldon[98, 29, 101]': 845,\n",
              " 'Sheldon[9, 34, 104]': 846,\n",
              " 'Sheldon[14, 103, 108]': 847,\n",
              " 'Sheldon[19, 44, 59]': 848,\n",
              " 'Sheldon[39, 102, 109]': 849,\n",
              " 'Raj[20, 75, 77, 69]': 850,\n",
              " 'Raj[25, 40, 50, 70]': 851,\n",
              " 'Raj[30, 45, 55]': 852,\n",
              " 'Raj[35, 72, 73]': 853,\n",
              " 'Raj[71, 76, 74]': 854,\n",
              " 'Raj[1, 78, 36, 81]': 855,\n",
              " 'Raj[41, 21, 80, 85]': 856,\n",
              " 'Raj[82, 79, 84]': 857,\n",
              " 'Raj[6, 83, 46]': 858,\n",
              " 'Raj[11, 26, 51]': 859,\n",
              " 'Raj[17, 31, 56]': 860,\n",
              " 'Raj[2, 62, 47]': 861,\n",
              " 'Raj[7, 27, 65]': 862,\n",
              " 'Raj[12, 32, 66]': 863,\n",
              " 'Raj[16, 63, 52]': 864,\n",
              " 'Raj[60, 64, 57]': 865,\n",
              " 'Raj[61, 37, 67]': 866,\n",
              " 'Raj[22, 42, 68]': 867,\n",
              " 'Raj[3, 43, 38]': 868,\n",
              " 'Raj[8, 88, 48]': 869,\n",
              " 'Raj[33, 90, 58]': 870,\n",
              " 'Raj[86, 94, 93]': 871,\n",
              " 'Raj[87, 18, 95]': 872,\n",
              " 'Raj[92, 28, 97]': 873,\n",
              " 'Raj[13, 89, 53]': 874,\n",
              " 'Raj[23, 91, 96]': 875,\n",
              " 'Raj[4, 99, 106]': 876,\n",
              " 'Raj[24, 100, 107]': 877,\n",
              " 'Raj[49, 105, 54]': 878,\n",
              " 'Raj[98, 29, 101]': 879,\n",
              " 'Raj[9, 34, 104]': 880,\n",
              " 'Raj[14, 103, 108]': 881,\n",
              " 'Raj[19, 44, 59]': 882,\n",
              " 'Raj[39, 102, 109]': 883,\n",
              " 'Penny[20, 75, 77, 69]': 884,\n",
              " 'Penny[25, 40, 50, 70]': 885,\n",
              " 'Penny[30, 45, 55]': 886,\n",
              " 'Penny[35, 72, 73]': 887,\n",
              " 'Penny[71, 76, 74]': 888,\n",
              " 'Penny[1, 78, 36, 81]': 889,\n",
              " 'Penny[41, 21, 80, 85]': 890,\n",
              " 'Penny[82, 79, 84]': 891,\n",
              " 'Penny[6, 83, 46]': 892,\n",
              " 'Penny[11, 26, 51]': 893,\n",
              " 'Penny[17, 31, 56]': 894,\n",
              " 'Penny[2, 62, 47]': 895,\n",
              " 'Penny[7, 27, 65]': 896,\n",
              " 'Penny[12, 32, 66]': 897,\n",
              " 'Penny[16, 63, 52]': 898,\n",
              " 'Penny[60, 64, 57]': 899,\n",
              " 'Penny[61, 37, 67]': 900,\n",
              " 'Penny[22, 42, 68]': 901,\n",
              " 'Penny[3, 43, 38]': 902,\n",
              " 'Penny[8, 88, 48]': 903,\n",
              " 'Penny[33, 90, 58]': 904,\n",
              " 'Penny[86, 94, 93]': 905,\n",
              " 'Penny[87, 18, 95]': 906,\n",
              " 'Penny[92, 28, 97]': 907,\n",
              " 'Penny[13, 89, 53]': 908,\n",
              " 'Penny[23, 91, 96]': 909,\n",
              " 'Penny[4, 99, 106]': 910,\n",
              " 'Penny[24, 100, 107]': 911,\n",
              " 'Penny[49, 105, 54]': 912,\n",
              " 'Penny[98, 29, 101]': 913,\n",
              " 'Penny[9, 34, 104]': 914,\n",
              " 'Penny[14, 103, 108]': 915,\n",
              " 'Penny[19, 44, 59]': 916,\n",
              " 'Penny[39, 102, 109]': 917,\n",
              " '韦小宝[20, 75, 77, 69]': 918,\n",
              " '韦小宝[25, 40, 50, 70]': 919,\n",
              " '韦小宝[30, 45, 55]': 920,\n",
              " '韦小宝[35, 72, 73]': 921,\n",
              " '韦小宝[71, 76, 74]': 922,\n",
              " '韦小宝[1, 78, 36, 81]': 923,\n",
              " '韦小宝[41, 21, 80, 85]': 924,\n",
              " '韦小宝[82, 79, 84]': 925,\n",
              " '韦小宝[6, 83, 46]': 926,\n",
              " '韦小宝[11, 26, 51]': 927,\n",
              " '韦小宝[17, 31, 56]': 928,\n",
              " '韦小宝[2, 62, 47]': 929,\n",
              " '韦小宝[7, 27, 65]': 930,\n",
              " '韦小宝[12, 32, 66]': 931,\n",
              " '韦小宝[16, 63, 52]': 932,\n",
              " '韦小宝[60, 64, 57]': 933,\n",
              " '韦小宝[61, 37, 67]': 934,\n",
              " '韦小宝[22, 42, 68]': 935,\n",
              " '韦小宝[3, 43, 38]': 936,\n",
              " '韦小宝[8, 88, 48]': 937,\n",
              " '韦小宝[33, 90, 58]': 938,\n",
              " '韦小宝[86, 94, 93]': 939,\n",
              " '韦小宝[87, 18, 95]': 940,\n",
              " '韦小宝[92, 28, 97]': 941,\n",
              " '韦小宝[13, 89, 53]': 942,\n",
              " '韦小宝[23, 91, 96]': 943,\n",
              " '韦小宝[4, 99, 106]': 944,\n",
              " '韦小宝[24, 100, 107]': 945,\n",
              " '韦小宝[49, 105, 54]': 946,\n",
              " '韦小宝[98, 29, 101]': 947,\n",
              " '韦小宝[9, 34, 104]': 948,\n",
              " '韦小宝[14, 103, 108]': 949,\n",
              " '韦小宝[19, 44, 59]': 950,\n",
              " '韦小宝[39, 102, 109]': 951,\n",
              " '乔峰[20, 75, 77, 69]': 952,\n",
              " '乔峰[25, 40, 50, 70]': 953,\n",
              " '乔峰[30, 45, 55]': 954,\n",
              " '乔峰[35, 72, 73]': 955,\n",
              " '乔峰[71, 76, 74]': 956,\n",
              " '乔峰[1, 78, 36, 81]': 957,\n",
              " '乔峰[41, 21, 80, 85]': 958,\n",
              " '乔峰[82, 79, 84]': 959,\n",
              " '乔峰[6, 83, 46]': 960,\n",
              " '乔峰[11, 26, 51]': 961,\n",
              " '乔峰[17, 31, 56]': 962,\n",
              " '乔峰[2, 62, 47]': 963,\n",
              " '乔峰[7, 27, 65]': 964,\n",
              " '乔峰[12, 32, 66]': 965,\n",
              " '乔峰[16, 63, 52]': 966,\n",
              " '乔峰[60, 64, 57]': 967,\n",
              " '乔峰[61, 37, 67]': 968,\n",
              " '乔峰[22, 42, 68]': 969,\n",
              " '乔峰[3, 43, 38]': 970,\n",
              " '乔峰[8, 88, 48]': 971,\n",
              " '乔峰[33, 90, 58]': 972,\n",
              " '乔峰[86, 94, 93]': 973,\n",
              " '乔峰[87, 18, 95]': 974,\n",
              " '乔峰[92, 28, 97]': 975,\n",
              " '乔峰[13, 89, 53]': 976,\n",
              " '乔峰[23, 91, 96]': 977,\n",
              " '乔峰[4, 99, 106]': 978,\n",
              " '乔峰[24, 100, 107]': 979,\n",
              " '乔峰[49, 105, 54]': 980,\n",
              " '乔峰[98, 29, 101]': 981,\n",
              " '乔峰[9, 34, 104]': 982,\n",
              " '乔峰[14, 103, 108]': 983,\n",
              " '乔峰[19, 44, 59]': 984,\n",
              " '乔峰[39, 102, 109]': 985,\n",
              " '神里绫华[20, 75, 77, 69]': 986,\n",
              " '神里绫华[25, 40, 50, 70]': 987,\n",
              " '神里绫华[30, 45, 55]': 988,\n",
              " '神里绫华[35, 72, 73]': 989,\n",
              " '神里绫华[71, 76, 74]': 990,\n",
              " '神里绫华[1, 78, 36, 81]': 991,\n",
              " '神里绫华[41, 21, 80, 85]': 992,\n",
              " '神里绫华[82, 79, 84]': 993,\n",
              " '神里绫华[6, 83, 46]': 994,\n",
              " '神里绫华[11, 26, 51]': 995,\n",
              " '神里绫华[17, 31, 56]': 996,\n",
              " '神里绫华[2, 62, 47]': 997,\n",
              " '神里绫华[7, 27, 65]': 998,\n",
              " '神里绫华[12, 32, 66]': 999,\n",
              " ...}"
            ]
          },
          "metadata": {},
          "execution_count": 126
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "id_value = {}"
      ],
      "metadata": {
        "id": "IIwhaBC3cIw9"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "import pandas as pd\n",
        "import numpy as np\n",
        "with open(\"/content/drive/MyDrive/GPTData/result.jsonl\", \"r\", encoding=\"utf-8\") as file:\n",
        "    file_lines = file.readlines()\n",
        "\n",
        "\n",
        "for line in file_lines:\n",
        "    json_line = json.loads(line)\n",
        "    qids = json_line[\"qids\"]\n",
        "    role_name = json_line[\"role_name\"]\n",
        "    # print(len(qids))\n",
        "    counter = 0\n",
        "    if role_name != \"汤师爷\":\n",
        "        qids = [[20, 75, 77, 69]] + json_line[\"qids\"]\n",
        "    for qid in qids:\n",
        "        id = qid_id[role_name + str(qid)]\n",
        "        factor = id_factor[id]\n",
        "        counter += 1\n",
        "    # print(\"length of qid: \", len(qids))\n",
        "    # print(qids)\n",
        "    N = get_row_means(json_line[\"N_table\"])\n",
        "    E = get_row_means(json_line[\"E_table\"])\n",
        "    O = get_row_means(json_line[\"O_table\"])\n",
        "    A = get_row_means(json_line[\"A_table\"])\n",
        "    C = get_row_means(json_line[\"C_table\"])\n",
        "    values = list(N.values) + list(E.values) + list(O.values) + list(A.values) + list(C.values)\n",
        "    # print(len(values))\n",
        "    # print(role_name, values)\n",
        "\n",
        "\n",
        "    id_value = {}\n",
        "    for index, value in enumerate(qids):\n",
        "        id = qid_id[role_name+str(value)]\n",
        "        id_value[id] = values[index]\n",
        "    print(id_value)\n",
        "    with open(\"/content/drive/MyDrive/GPTData/new_result.jsonl\", \"a\") as jsonl_file:\n",
        "        added_score = {\n",
        "            \"role_name\": role_name,\n",
        "            \"N\":{\n",
        "                \"score\": json_line[\"N\"],\n",
        "                \"sub_factors\": json_line[\"N\"][\"sub_factors\"]\n",
        "            },\n",
        "            \"E\":{\n",
        "                \"score\": json_line[\"E\"],\n",
        "                \"sub_factors\": json_line[\"E\"][\"sub_factors\"]\n",
        "            },\n",
        "            \"O\":{\n",
        "                \"score\": json_line[\"O\"],\n",
        "                \"sub_factors\": json_line[\"O\"][\"sub_factors\"]\n",
        "            },\n",
        "            \"A\":{\n",
        "                \"score\": json_line[\"A\"],\n",
        "                \"sub_factors\": json_line[\"A\"][\"sub_factors\"]\n",
        "            },\n",
        "            \"C\":{\n",
        "                \"score\": json_line[\"C\"],\n",
        "                \"sub_factors\": json_line[\"C\"][\"sub_factors\"]\n",
        "            },\n",
        "            \"qids\": qids,\n",
        "            \"N_table\" : json_line[\"N_table\"],\n",
        "            \"E_table\" : json_line[\"E_table\"],\n",
        "            \"O_table\" : json_line[\"O_table\"],\n",
        "            \"A_table\" : json_line[\"A_table\"],\n",
        "            \"C_table\" : json_line[\"C_table\"],\n",
        "            \"id_value\": id_value\n",
        "        }\n",
        "        json.dump(added_score, jsonl_file, ensure_ascii=False)\n",
        "        jsonl_file.write('\\n')\n",
        "\n"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "R3VBjDmP-dog",
        "outputId": "a01f0785-1934-4a96-a9e1-9c741ab94eba"
      },
      "execution_count": null,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "{0: -5.0, 1: 5.0, 2: 2.0, 3: -2.0, 4: 2.0, 5: -2.0, 6: -2.0, 7: -2.0, 8: -2.0, 9: -2.0, 10: -2.0, 11: 2.0, 12: 2.0, 13: -2.0, 14: 2.0, 15: -2.0, 16: -2.0, 17: -2.0, 18: 2.0, 19: 0.0, 20: -2.0, 21: -2.0, 22: -2.0, 23: 2.0, 24: 2.0, 25: -2.0, 26: 2.0, 27: 2.0, 28: -2.0, 29: 2.0, 30: -2.0, 31: -2.0, 32: 2.0, 33: -2.0}\n",
            "{34: -2.0, 35: -2.0, 36: -5.0, 37: -5.0, 38: -5.0, 39: -2.0, 40: 5.0, 41: 2.0, 42: 2.0, 43: -2.0, 44: 2.0, 45: 2.0, 46: 2.0, 47: -2.0, 48: 2.0, 49: 2.0, 50: 5.0, 51: -2.0, 52: 2.0, 53: -2.0, 54: -2.0, 55: -2.0, 56: -2.0, 57: 0.0, 58: -2.0, 59: 2.0, 60: 2.0, 61: 5.0, 62: 5.0, 63: 2.0, 64: 5.0, 65: 5.0, 66: -2.0, 67: 5.0}\n",
            "{68: -2.0, 69: -2.0, 70: -2.0, 71: -2.0, 72: -2.0, 73: -2.0, 74: 2.0, 75: -2.0, 76: -2.0, 77: -2.0, 78: 2.0, 79: -2.0, 80: -5.0, 81: -5.0, 82: -2.0, 83: -2.0, 84: -2.0, 85: -2.0, 86: -2.0, 87: -2.0, 88: -2.0, 89: 2.0, 90: -2.0, 91: -2.0, 92: 2.0, 93: -2.0, 94: 2.0, 95: 5.0, 96: 0.0, 97: -2.0, 98: 2.0, 99: -2.0, 100: 2.0, 101: 5.0}\n",
            "{102: -2.0, 103: 2.0, 104: 2.0, 105: -2.0, 106: -2.0, 107: 2.0, 108: 5.0, 109: 0.0, 110: 2.0, 111: 5.0, 112: -2.0, 113: 5.0, 114: 5.0, 115: 5.0, 116: 5.0, 117: 5.0, 118: 5.0, 119: 5.0, 120: -2.0, 121: 0.0, 122: -2.0, 123: 5.0, 124: 5.0, 125: 5.0, 126: 5.0, 127: 2.0, 128: -2.0, 129: 0.0, 130: 2.0, 131: -2.0, 132: 5.0, 133: -2.0, 134: 2.0, 135: -2.0}\n",
            "{136: -2.0, 137: -2.0, 138: -2.0, 139: -2.0, 140: -5.0, 141: 5.0, 142: 5.0, 143: 2.0, 144: 2.0, 145: 5.0, 146: 2.0, 147: 2.0, 148: -2.0, 149: -2.0, 150: 5.0, 151: 2.0, 152: 2.0, 153: -2.0, 154: 2.0, 155: -2.0, 156: -2.0, 157: -2.0, 158: -2.0, 159: -2.0, 160: -2.0, 161: -2.0, 162: -2.0, 163: -2.0, 164: 2.0, 165: -2.0, 166: 2.0, 167: -2.0, 168: -2.0, 169: -2.0}\n",
            "{170: 5.0, 171: -2.0, 172: -2.0, 173: -2.0, 174: -2.0, 175: -2.0, 176: -2.0, 177: -2.0, 178: -2.0, 179: -2.0, 180: 5.0, 181: -2.0, 182: -2.0, 183: -2.0, 184: 2.0, 185: -2.0, 186: -2.0, 187: -2.0, 188: 2.0, 189: -2.0, 190: 5.0, 191: 0.0, 192: -2.0, 193: 2.0, 194: 2.0, 195: 2.0, 196: -2.0, 197: -2.0, 198: -2.0, 199: 0.0, 200: 2.0, 201: 2.0, 202: -2.0, 203: -2.0}\n",
            "{204: -2.0, 205: -2.0, 206: -2.0, 207: -2.0, 208: -2.0, 209: -2.0, 210: -2.0, 211: -2.0, 212: -2.0, 213: -2.0, 214: -2.0, 216: 2.0, 217: 2.0, 218: 2.0, 219: 2.0, 220: 2.0, 221: -2.0, 222: 2.0, 223: 2.0, 224: -2.0, 225: 0.0, 226: -2.0, 227: -2.0, 228: 2.0, 229: -2.0, 230: 2.0, 231: 2.0, 232: 2.0, 233: 0.0, 234: 2.0, 235: 5.0, 236: 2.0, 237: 5.0}\n",
            "{238: -2.0, 239: 5.0, 240: -2.0, 241: -5.0, 242: -2.0, 243: -2.0, 244: -2.0, 245: -2.0, 246: -5.0, 247: -2.0, 248: -2.0, 249: -2.0, 250: -2.0, 251: -2.0, 252: -2.0, 253: -2.0, 254: -2.0, 255: -2.0, 256: -2.0, 257: -2.0, 258: -2.0, 259: -2.0, 260: -2.0, 261: -2.0, 262: -2.0, 263: -2.0, 264: 2.0, 265: 5.0, 266: 0.0, 267: 2.0, 268: 2.0, 269: 0.0, 270: -2.0, 271: 5.0}\n",
            "{272: -2.0, 273: -2.0, 274: -5.0, 275: -2.0, 276: -2.0, 277: -2.0, 278: 2.0, 279: 5.0, 280: 5.0, 281: 5.0, 282: 2.0, 283: 5.0, 284: 2.0, 285: 5.0, 286: 2.0, 287: 5.0, 288: 5.0, 289: 2.0, 290: 0.0, 291: -2.0, 292: -2.0, 293: -2.0, 294: -2.0, 295: -2.0, 296: 0.0, 297: -2.0, 298: 5.0, 299: -2.0, 300: 2.0, 301: 0.0, 302: 2.0, 303: 5.0, 304: -2.0, 305: 2.0}\n",
            "{306: -2.0, 307: -2.0, 308: -2.0, 309: -2.0, 310: -2.0, 311: -2.0, 312: -2.0, 313: -2.0, 314: -2.0, 315: -2.0, 316: -2.0, 317: -2.0, 318: -2.0, 319: -2.0, 320: -2.0, 321: -2.0, 322: -2.0, 323: -2.0, 324: -2.0, 325: -2.0, 326: -2.0, 327: -2.0, 328: -2.0, 329: -2.0, 330: -2.0, 331: -2.0, 332: 2.0, 333: 2.0, 334: 5.0, 335: -2.0, 336: 2.0, 337: -2.0, 338: 2.0, 339: 5.0}\n",
            "{340: -2.0, 341: 2.0, 342: 2.0, 343: 2.0, 344: 2.0, 345: -2.0, 346: -2.0, 347: -2.0, 348: -2.0, 349: -2.0, 350: -5.0, 351: 2.0, 352: -2.0, 353: 2.0, 354: -2.0, 355: 2.0, 356: 5.0, 357: -2.0, 358: 5.0, 359: 5.0, 360: 2.0, 361: 5.0, 362: 5.0, 363: 5.0, 364: 2.0, 365: 5.0, 366: -2.0, 367: 2.0, 368: 2.0, 369: 2.0, 370: 5.0, 371: -2.0, 372: -2.0, 373: 2.0}\n",
            "{374: -2.0, 375: -2.0, 376: -2.0, 377: -2.0, 378: -2.0, 379: 5.0, 380: -2.0, 381: 2.0, 382: -2.0, 383: -2.0, 384: -2.0, 385: -2.0, 386: -2.0, 387: -2.0, 388: 2.0, 389: 2.0, 390: -2.0, 391: -2.0, 392: 5.0, 393: 2.0, 394: -2.0, 395: -2.0, 396: 2.0, 397: 0.0, 398: 5.0, 399: 2.0, 400: 5.0, 401: 2.0, 402: 5.0, 403: 2.0, 404: 5.0, 405: 5.0, 406: -2.0, 407: 5.0}\n",
            "{408: -2.0, 409: -2.0, 410: -2.0, 411: -5.0, 412: 2.0, 413: 5.0, 414: 2.0, 415: 5.0, 416: -2.0, 417: 5.0, 418: -2.0, 419: 5.0, 420: 2.0, 421: -2.0, 422: 2.0, 423: 2.0, 424: -2.0, 425: 5.0, 426: 5.0, 427: 5.0, 428: 5.0, 429: 5.0, 430: 5.0, 431: 5.0, 432: 5.0, 433: 2.0, 434: 2.0, 435: -2.0, 436: 4.0, 437: 0.0, 438: 5.0, 439: -2.0, 440: -2.0, 441: 2.0}\n",
            "{442: -2.0, 443: -2.0, 444: -2.0, 445: -2.0, 446: -2.0, 447: 2.0, 448: 2.0, 449: 2.0, 450: -2.0, 451: -2.0, 452: -2.0, 453: 2.0, 454: 5.0, 455: 5.0, 456: 5.0, 457: 5.0, 458: 5.0, 459: 5.0, 460: 2.0, 461: 2.0, 462: -2.0, 463: 5.0, 464: 2.0, 465: 2.0, 466: 5.0, 467: 0.0, 468: 5.0, 469: 5.0, 470: 5.0, 471: 5.0, 472: 2.0, 473: 5.0, 474: 2.0, 475: 5.0}\n",
            "{476: -2.0, 477: -2.0, 478: -2.0, 479: -2.0, 480: -2.0, 481: 2.0, 482: 2.0, 483: 2.0, 484: 2.0, 485: 2.0, 486: 5.0, 487: 5.0, 488: 5.0, 489: 5.0, 490: 5.0, 491: 5.0, 492: 5.0, 493: 2.0, 494: 5.0, 495: 5.0, 496: 2.0, 497: 5.0, 498: 2.0, 499: 2.0, 500: 2.0, 501: 2.0, 502: 2.0, 503: 5.0, 504: 5.0, 505: 2.0, 506: -2.0, 507: 2.0, 508: 2.0, 509: 5.0}\n",
            "{510: 2.0, 511: 2.0, 512: 5.0, 513: -2.0, 514: -2.0, 515: -2.0, 516: 2.0, 517: 0.0, 518: 2.0, 519: -2.0, 520: -2.0, 521: 2.0, 522: 2.0, 523: 2.0, 524: 2.0, 525: 2.0, 526: 5.0, 527: 5.0, 528: 5.0, 529: 2.0, 530: -2.0, 531: 5.0, 532: 2.0, 533: 5.0, 534: 5.0, 535: 2.0, 536: 5.0, 537: 5.0, 538: 5.0, 539: 0.0, 540: 5.0, 541: 2.0, 542: -2.0, 543: 2.0}\n",
            "{544: 2.0, 545: 2.0, 546: -2.0, 547: -2.0, 548: -2.0, 549: -2.0, 550: 5.0, 551: 0.0, 552: -2.0, 553: -2.0, 554: -2.0, 555: 2.0, 556: -2.0, 557: -2.0, 558: 2.0, 559: 2.0, 560: -2.0, 561: -2.0, 562: 2.0, 563: 5.0, 564: -2.0, 565: -2.0, 566: 5.0, 567: 5.0, 568: 5.0, 569: 2.0, 570: 5.0, 571: 5.0, 572: 2.0, 573: 5.0, 574: 5.0, 575: 5.0, 576: 5.0, 577: -2.0}\n",
            "{578: -2.0, 579: 0.0, 580: -2.0, 581: -2.0, 582: -2.0, 583: -2.0, 584: 0.0, 585: -2.0, 586: -2.0, 587: -2.0, 588: -2.0, 589: -2.0, 590: 5.0, 591: -2.0, 592: 5.0, 593: -2.0, 594: 5.0, 595: 5.0, 596: 5.0, 597: -2.0, 598: -2.0, 599: 2.0, 600: 5.0, 601: 2.0, 602: 5.0, 603: 0.0, 604: 2.0, 605: 5.0, 606: 2.0, 607: 5.0, 608: 2.0, 609: 5.0, 610: 2.0, 611: 5.0}\n",
            "{612: -2.0, 613: 0.0, 614: -2.0, 615: -2.0, 616: -2.0, 617: 2.0, 618: 5.0, 619: 2.0, 620: -2.0, 621: 5.0, 622: -2.0, 623: 2.0, 624: 2.0, 625: -2.0, 626: 5.0, 627: 5.0, 628: 2.0, 629: -2.0, 630: 2.0, 631: -2.0, 632: 2.0, 633: -2.0, 634: -2.0, 635: 2.0, 636: 5.0, 637: 2.0, 638: 2.0, 639: 2.0, 640: 2.0, 641: 0.0, 642: 2.0, 643: -2.0, 644: 2.0, 645: -2.0}\n",
            "{646: -2.0, 647: -5.0, 648: -2.0, 649: -2.0, 650: -5.0, 651: 2.0, 652: 5.0, 653: -2.0, 654: 2.0, 655: 2.0, 656: -2.0, 657: 2.0, 658: -2.0, 659: -2.0, 660: 5.0, 661: 2.0, 662: 5.0, 663: -2.0, 664: 2.0, 665: 5.0, 666: 0.0, 667: 2.0, 668: 5.0, 669: 5.0, 670: 2.0, 671: 2.0, 672: 2.0, 673: 2.0, 674: 5.0, 675: -2.0, 676: 2.0, 677: -2.0, 678: 2.0, 679: 2.0}\n",
            "{680: -2.0, 681: -2.0, 682: -2.0, 683: -2.0, 684: -2.0, 685: 2.0, 686: 5.0, 687: 2.0, 688: 5.0, 689: 5.0, 690: 5.0, 691: -2.0, 692: -2.0, 693: -2.0, 694: 2.0, 695: -2.0, 696: -2.0, 697: -5.0, 698: -2.0, 699: -2.0, 700: 2.0, 701: 0.0, 702: 5.0, 703: -2.0, 704: 2.0, 705: -2.0, 706: 2.0, 707: -2.0, 708: -2.0, 709: -2.0, 710: 2.0, 711: -2.0, 712: -2.0, 713: -2.0}\n",
            "{714: -2.0, 715: -2.0, 716: -2.0, 717: -5.0, 718: -2.0, 719: -2.0, 720: 2.0, 721: -2.0, 722: -2.0, 723: -2.0, 724: -2.0, 725: -2.0, 726: 2.0, 727: -2.0, 728: 2.0, 729: 2.0, 730: 2.0, 731: 2.0, 732: -2.0, 733: -2.0, 734: -2.0, 735: -2.0, 736: -2.0, 737: -2.0, 738: 2.0, 739: -2.0, 740: -2.0, 741: -2.0, 742: -2.0, 743: -2.0, 744: 2.0, 745: -2.0, 746: -2.0, 747: -2.0}\n",
            "{748: -4.0, 749: -2.0, 750: -5.0, 751: -2.0, 752: -2.0, 753: -2.0, 754: -2.0, 755: -2.0, 756: -2.0, 757: -2.0, 758: -2.0, 759: -2.0, 760: 2.0, 761: 2.0, 762: 2.0, 763: 2.0, 764: 5.0, 765: -2.0, 766: 5.0, 767: 5.0, 768: -2.0, 769: -2.0, 770: -2.0, 771: 2.0, 772: 2.0, 773: 0.0, 774: 5.0, 775: 2.0, 776: 2.0, 777: 0.0, 778: 5.0, 779: 5.0, 780: 2.0, 781: 2.0}\n",
            "{782: -2.0, 783: -2.0, 784: -5.0, 785: -2.0, 786: -2.0, 787: 5.0, 788: 5.0, 789: 5.0, 790: 5.0, 791: 5.0, 792: 5.0, 793: 5.0, 794: 2.0, 795: 5.0, 796: 5.0, 797: 5.0, 798: 5.0, 799: 5.0, 800: 2.0, 801: 2.0, 802: 5.0, 803: -2.0, 804: 2.0, 805: 2.0, 806: 2.0, 807: 2.0, 808: 2.0, 809: 0.0, 810: 2.0, 811: 0.0, 812: -2.0, 813: -2.0, 814: -2.0, 815: -2.0}\n",
            "{816: -2.0, 817: -2.0, 818: -5.0, 819: -2.0, 820: -2.0, 821: -2.0, 822: 0.0, 823: -2.0, 824: -2.0, 825: -2.0, 826: -2.0, 827: 5.0, 828: 5.0, 829: 5.0, 830: -2.0, 831: -2.0, 832: -2.0, 833: 2.0, 834: -2.0, 835: -2.0, 836: -2.0, 837: -2.0, 838: -2.0, 839: -2.0, 840: 2.0, 841: -2.0, 842: 5.0, 843: 5.0, 844: 5.0, 845: 2.0, 846: 5.0, 847: 5.0, 848: 5.0, 849: 5.0}\n",
            "{850: 2.0, 851: 5.0, 852: 2.0, 853: 2.0, 854: 2.0, 855: 2.0, 856: 2.0, 857: -2.0, 858: 5.0, 859: 2.0, 860: -2.0, 861: 2.0, 862: 5.0, 863: 2.0, 864: 5.0, 865: 5.0, 866: 5.0, 867: 2.0, 868: -2.0, 869: 2.0, 870: 2.0, 871: -2.0, 872: 5.0, 873: 5.0, 874: 2.0, 875: 0.0, 876: 5.0, 877: 5.0, 878: 2.0, 879: 2.0, 880: 2.0, 881: -2.0, 882: -2.0, 883: 2.0}\n",
            "{884: -2.0, 885: 2.0, 886: -2.0, 887: -2.0, 888: -2.0, 889: 2.0, 890: -2.0, 891: 5.0, 892: 2.0, 893: 5.0, 894: 5.0, 895: -2.0, 896: -2.0, 897: 2.0, 898: 2.0, 899: 2.0, 900: -2.0, 901: -2.0, 902: 2.0, 903: 2.0, 904: 5.0, 905: 5.0, 906: 5.0, 907: 2.0, 908: 5.0, 909: 2.0, 910: -2.0, 911: -2.0, 912: -2.0, 913: 0.0, 914: 2.0, 915: -2.0, 916: -2.0, 917: -2.0}\n",
            "{918: -5.0, 919: -5.0, 920: -2.0, 921: -5.0, 922: -2.0, 923: 2.0, 924: 5.0, 925: 2.0, 926: 2.0, 927: 5.0, 928: 5.0, 929: 2.0, 930: -2.0, 931: -2.0, 932: 2.0, 933: -2.0, 934: -2.0, 935: -2.0, 936: -2.0, 937: -2.0, 938: 2.0, 939: -2.0, 940: -2.0, 941: 2.0, 942: -2.0, 943: -2.0, 944: 2.0, 945: -2.0, 946: 0.0, 947: -2.0, 948: -2.0, 949: 2.0, 950: -2.0, 951: -2.0}\n",
            "{952: -2.0, 953: -2.0, 954: -5.0, 955: -2.0, 956: -2.0, 957: 2.0, 958: 5.0, 959: -2.0, 960: 2.0, 961: -2.0, 962: -2.0, 963: -2.0, 964: -2.0, 965: -2.0, 966: 2.0, 967: 2.0, 968: -2.0, 969: -2.0, 970: 0.0, 971: 2.0, 972: -2.0, 973: -2.0, 974: 5.0, 975: -2.0, 976: 2.0, 977: 0.0, 978: 5.0, 979: 2.0, 980: 5.0, 981: 0.0, 982: 5.0, 983: 2.0, 984: 5.0, 985: 5.0}\n",
            "{986: 2.0, 987: -2.0, 988: -2.0, 989: -2.0, 990: -2.0, 991: 0.0, 992: 2.0, 993: -2.0, 994: 2.0, 995: -2.0, 996: 2.0, 997: 5.0, 998: 2.0, 999: 5.0, 1000: 2.0, 1001: 2.0, 1002: 2.0, 1003: 2.0, 1004: 5.0, 1005: 5.0, 1006: 2.0, 1007: 5.0, 1008: 5.0, 1009: 2.0, 1010: 2.0, 1011: 2.0, 1012: 5.0, 1013: 5.0, 1014: 5.0, 1015: 5.0, 1016: 5.0, 1017: 5.0, 1018: 5.0, 1019: 2.0}\n",
            "{1020: -5.0, 1021: -2.0, 1022: -2.0, 1023: -5.0, 1024: -2.0, 1025: -5.0, 1026: -2.0, 1027: -2.0, 1028: -2.0, 1029: -2.0, 1030: -2.0, 1031: -2.0, 1032: -2.0, 1033: -2.0, 1034: -2.0, 1035: -2.0, 1036: -2.0, 1037: -2.0, 1038: 0.0, 1039: 2.0, 1040: -2.0, 1041: -2.0, 1042: 5.0, 1043: -2.0, 1044: 5.0, 1045: 2.0, 1046: 5.0, 1047: 5.0, 1048: 5.0, 1049: 5.0, 1050: 5.0, 1051: 5.0, 1052: 2.0, 1053: 5.0}\n",
            "{1054: -2.0, 1055: 2.0, 1056: 2.0, 1057: 5.0, 1058: -2.0, 1059: -2.0, 1060: -2.0, 1061: -2.0, 1062: -2.0, 1063: 2.0, 1064: 2.0, 1065: 2.0, 1066: -2.0, 1067: -2.0, 1068: 2.0, 1069: -2.0, 1070: -2.0, 1071: -2.0, 1072: -2.0, 1073: -2.0, 1074: -2.0, 1075: -2.0, 1076: -2.0, 1077: -2.0, 1078: 2.0, 1079: 2.0, 1080: -5.0, 1081: -2.0, 1082: -2.0, 1083: -5.0, 1084: -2.0, 1085: -2.0, 1086: -2.0, 1087: -2.0}\n"
          ]
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "     sub_table = {'E6': [2, 2, 'null', '2', 2, 5], 'E2': [2, 'null', 'null', '2', 2, 5], 'E4': [2, 2, 2, 'null', 2, 5], 'E1': [2, 2, 2, 'null', 'null', 'null'], 'E3': ['null', 2, 2, '2', 'null', 'null']}"
      ],
      "metadata": {
        "id": "s5JskvhXBMao"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "df = pd.DataFrame(sub_table)\n",
        "df = df.replace(\"null\", np.nan)\n",
        "df = df.apply(pd.to_numeric, errors='coerce')\n",
        "df.mean(axis=1)"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "mKC49FyVRrKT",
        "outputId": "97a35a21-a347-49a1-f885-831c55268951"
      },
      "execution_count": null,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "0    2.0\n",
              "1    2.0\n",
              "2    2.0\n",
              "3    2.0\n",
              "4    2.0\n",
              "5    5.0\n",
              "dtype: float64"
            ]
          },
          "metadata": {},
          "execution_count": 113
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [],
      "metadata": {
        "id": "dd_5VHEhRttM"
      },
      "execution_count": null,
      "outputs": []
    }
  ]
}